Jump to content

[Solved] Issues with setting animation to standing frame


AlysiumX
 Share

Recommended Posts

So I am having issue getting my animation frame to reset to standing. I traced the logic and it is actually hitting play on the stand animation, but its not setting it.

 

Here is my code:

 

Setup

this.sprite.animations.add('StandBackward', 'stand_up.png');

Animation Logic

if(this.direction == GameTypes.Direction.Up){    if(this.attacking){      this.sprite.animations.play('AttackUp');      if(this.sprite.animations.currentFrame.name == "attack_up_2.png" && !this.justAttacked){        this.justAttacked = true;        this.attackHitBox.x = this.sprite.x - 25;        this.attackHitBox.y = this.sprite.y - 60;      }    }    else if(this.blocking){      this.sprite.animations.play('BlockUp');    }    else if(this.moving){      this.sprite.animations.play('WalkBackward');    }    if(!this.attacking && !this.blocking && !this.moving){      this.sprite.animations.play('StandBackward');    }}

Thanks

 

Edit : I figured it out apparently animations do not reset after you play them, so I had to manually reset it to first frame on the complete animation event handler using 

this.sprite.animations.stop(null, true);
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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