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 niroop

HI, i have two separate entities with separate animation sheets. how can I change the animation of other entity in this entity's update function?

.requires(
	'impact.entity',
	
	'game.entities.player2'
)
update: function() {
		var player = ig.game.getEntitiesByType( EntityPlayer2 )[0];
                if (this.vel.x > 200) {
                   this.currentAnim = this.anims.disappear;
                    // this is where i need player2's run animation
                   player2.currenAnim = player2.anims.run;
                }
}

1 decade ago by dominic

You can access other entities through the Game's .getEntityByName() or .getEntitiesByType() methods.
Page 1 of 1
« first « previous next › last »