Santiago Posted September 21, 2017 Share Posted September 21, 2017 Hello, today my problem looks so stupid, but I can't find a way to solve it. I have a couple of animations that I add using: this.player.animations.add('idle', Phaser.Animation.generateFrameNames('idle_',1,4), 6, true); this.player.animations.add('ataque', Phaser.Animation.generateFrameNames('ataque_',1,2), 10, true); this.player.animations.add('daño', Phaser.Animation.generateFrameNames('daño_',1,2), 5, true); this.player.animations.add('camina', Phaser.Animation.generateFrameNames('camina_',1,5), 10, true); this.player.animations.add('muerte', Phaser.Animation.generateFrameNames('muerte_',1,10), 5, true); Everything's perfect, using this.animations,play('string') I can play it as well, but here's my problem: To make my player attack I use Key.justDown, because I want it to attack once per pressing, but if I do: if(this.Q.justDown){ this.player.animations.play('ataque'); } in this case this.Q = game.input.keyboard.addKey(Phaser.Keyboard.Q); and is the same I use to make attacks if I use the propertie isDown it plays it, but is useless for me becasue the attack have finished and the animation still looping, even if I set to false the 4th parameter of animations.add. Link to comment Share on other sites More sharing options...
samme Posted September 21, 2017 Share Posted September 21, 2017 Set the loop parameter to false in any case. Try this.game.debug.key(this.Q, /* … */); Link to comment Share on other sites More sharing options...
Santiago Posted September 21, 2017 Author Share Posted September 21, 2017 1 hour ago, samme said: Set the loop parameter to false in any case. Try this.game.debug.key(this.Q, /* … */); I set the loop parameter to false and still replaying it, using isDown propertie, but with justDown (what I need), doesn't play it at all, still playing the idle (I think I didin't say this, I forgot it) Link to comment Share on other sites More sharing options...
samid737 Posted September 22, 2017 Share Posted September 22, 2017 you can try using input events as an alternative: Link to comment Share on other sites More sharing options...
Santiago Posted October 3, 2017 Author Share Posted October 3, 2017 On 22/9/2017 at 11:34 AM, samid737 said: you can try using input events as an alternative: I tried but seems to do nothing, it just stop for a moment the current animation (idle), but anything else, I don't know what else to do Link to comment Share on other sites More sharing options...
Recommended Posts