Sign in to follow this  
danteAGAIN

Stop animation

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

Share this post


Link to post
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);

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.