danteAGAIN Posted July 3, 2017 Share Posted July 3, 2017 hello, I need your help guy, i would create an animation with my character. When i push left click (mouse), the animation start but she is infinite. How stop my animation? my code: create: function() { this.player.animations.add('atk', [529, 532, 535, 538, 541], 10); this.game.input.onDown.add(this.atk, this); }, atk: function(){ this.atkBool = true; }, update(){ if (this.game.input.onDown && this.atkBool == true){ var anim = this.player.animations.play('atk'); } I want just 1 loop so stop animation after my "541" frames. Sorry for my english langage. I hope you can help me. Good day Link to comment Share on other sites More sharing options...
jpdev Posted July 3, 2017 Share Posted July 3, 2017 https://photonstorm.github.io/phaser-ce/Phaser.AnimationManager.html The next parameter after framerate is a boolean for loop. So it's this.player.animations.add('atk', [529, 532, 535, 538, 541], 10, false); to not have it loop. Link to comment Share on other sites More sharing options...
danteAGAIN Posted July 3, 2017 Author Share Posted July 3, 2017 10 minutes ago, jpdev said: Https://photonstorm.github.io/phaser-ce/Phaser.AnimationManager.html Le paramètre suivant après framerate est un boolean pour la boucle. Alors c'est This.player.animations.add ('atk', [529, 532, 535, 538, 541], 10, faux); Pour ne pas l'avoir en boucle. thx to try help me, I have try "false", but the animation don't stop again. I have try to add : this.player.animations.stop() and this.atkBool = false; but just 1 frame is display (529); Link to comment Share on other sites More sharing options...
danteAGAIN Posted July 3, 2017 Author Share Posted July 3, 2017 I am in the infinite loop, i have write console.log("test") like this : update(){ if (this.game.input.onDown && this.atkBool == true){ var anim = this.player.animations.play('atk'); console.log("test") } In the console i can see a infinite loop and i don't know why .... if anyone can help me, it's will nice Link to comment Share on other sites More sharing options...
Recommended Posts