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 paulh

Hi All

Ive been trying to make a spawned player entity collide with a moving "baddie" entity but i can t get them to collide ...

This works fine, the baddie generares and collides:

animSheet: new ig.AnimationSheet( 'media/320x480/hats.png', 32, 32 ),

	bounciness: 1,
	init: function( x, y, settings ) {
		this.parent( x, y, settings );
		
		this.addAnim( 'idle', 2.1, [0] );
		
		this.vel.x = -240;
		this.vel.y = 100;
	},


}); 

When i add this it no longer collides?


update: function() {
    
    // Has the animation completely run through? -> kill it
    if( this.currentAnim.loopCount ) {
        this.kill();
	
    }
    this.currentAnim.update();
    return;
    }
}); 

1 decade ago by dominic

Call this.parent() at the end of your update() method. It will calculate the entities physics and moves it accordingly.

1 decade ago by paulh

duh!


Thx
Page 1 of 1
« first « previous next › last »