Jump to content

Stop animation


danteAGAIN
 Share

Recommended Posts

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

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...