kriket Posted July 27, 2015 Share Posted July 27, 2015 So the problem i am having is that I expect the sprite to be his idle self when no up key is pressed and when an up key is pressed, obv the animation should play. Thing is, after the first time UP is pressed, the animation playes BUT the sprite stays in player_jump.png and not idle pose (default sprite). create: function () { this.player = this.game.add.sprite(this.game.width/2, this.game.height/2, 'player', 'player2.png'); this.player.animations.add('jump', [// 'player2.png', 'player_jump.png', ], 20, false, false); }, if(this.cursors.up.isDown) { this.playerJump(); this.player.animations.play('jump'); } else if(this.cursors.left.isDown) { this.player.body.velocity.x = -BasicGame.ACCELERATION; } else if (this.cursors.right.isDown) { this.player.body.velocity.x = BasicGame.ACCELERATION; } else { this.player.body.velocity.x = 0; this.player.animations.stop(); } Link to comment Share on other sites More sharing options...
kriket Posted July 27, 2015 Author Share Posted July 27, 2015 Solved with the "this.player.frameName" property. Link to comment Share on other sites More sharing options...
Recommended Posts