1 decade ago by auz1111
For some reason my animation stays at the last frame after playing, and I can;t get it to rewind.
Ultimately I am trying to figure out when the animation is finished and then allow the player to move left.
hammerSwingAnimSheet: new ig.AnimationSheet( 'media/cali-hammer-swing.png', 125, 115 ),
this.hammerSwing = new ig.Animation( this.hammerSwingAnimSheet, 0.06, [0,1,2,3,4,5,6,7], true );
if (ig.input.pressed('punch') && !this.attacking && !this.jumping) {
console.log("Punching..");
this.tempDirection = this.direction;
this.direction = 0;
this.vel.x = this.vel.y = 0;
this.currentAnim = this.hammerSwing.rewind();
//console.log('Changing animationComplete to false...');
//this.animationComplete = false;
this.hammerSwing.rewind();
this.hammerSwing.frame=0;
this.currentAnim.rewind();
this.action = "punch";
this.isPunching = true;
this.attacking = true;
ig.game.sounds.bam.play();
currentanimation = 3;
// ig.game.sounds.swing.play();
} else if (ig.input.released('punch')) {
this.isPunching = false;
this.attacking = false;
}
//MOVE LEFT
}else if( ig.input.state('left') && ismove != 1 && ismove != 2 && ismove != 4 && this.currentAnim.frame==0 ) {
console.log("Moving left...");
}
Ultimately I am trying to figure out when the animation is finished and then allow the player to move left.
