Jump to content

Hit an enemy animation, collision and looping problem


vernonr
 Share

Recommended Posts

Hello again. New problems arise everyday! I have a character who has an animation called "hit". Here's the strip of frames.

 

post-11774-0-63315800-1417303149.jpg

 

So in my code I have this little something that makes the character "hit" when the btnGolpe is down:

 

btnGolpe = game.input.keyboard.addKey(Phaser.Keyboard.M);
 
in function update ():
 
else if (btnGolpe.isDown) {
player.animations.play('golpe'); 
}

 

The problems?

1) The animation keeps looping if btnGolpe is down. It should only play once per button pressing.

2) I need that the character actually "hits" it's opponent with his fist. Is there a way to do this? The collision should be between the fist and the opponent. Bare in mind that the fist is shown in one frame of the whole animation, so it show only register the collision in that frame, in that position (the fist, in this case).

 

I'm really looking forward for your advise on these things. Thanks in advance, people!

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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