Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fdario2000

Hi,

I am new with Impact and trying to change something at Pong game because velocity is very slow. I have been searching in the forum and other places so, tried lot fo things but nothing worked for me. I would like to increase velocity but it did not happen. This is my code:

ig.module(
'game.entities.puck'
)
.requires(
'impact.entity'
)
.defines(function(){

EntityPuck = ig.Entity.extend({

maxVel: { x: 500, y: 500 },
size: {x:48, y:48},
collides: ig.Entity.COLLIDES.ACTIVE,

animSheet: new ig.AnimationSheet( 'media/puck.png', 48, 48 ),

bounciness: 1,

init: function( x, y, settings ) {
this.parent( x, y, settings );

this.addAnim( 'idle', 0.1, [0,1,2,3,4,4,4,4,3,2,1] );

this.vel.x = 200;
this.vel.y = 100;
}

update: function() {

this.vel.x *= 2;
this.vel.y *= 2;
}

},

});

});

What is wrong?

Thanks in advance.
Dario Sanchez.

1 decade ago by Joncom

Make sure you add this.parent() to your update function.
It's important because that is where velocity is applied to the entity.
Page 1 of 1
« first « previous next › last »