[SOLVED] 8 Way Movement add Punch

nickquest

  • Posts: 60
I'm trying to add a punch ability to the standard 8 Way Movement behavior, but so far it only works when the character is stopped. I've tried it a few different ways, but still no difference. It does however make the walk cycle start over, so it may be switching to the punch image but instantly switching back to the walk animation. Can anyone tell if that is the case and if so how to force it to stay on the punch image long enough to be seen?

« Last Edit: November 23, 2014, 04:30:52 pm by nickquest »

ETHproductions

  • *
  • Posts: 430
Hey, I know that block at the top... I'm glad to see someone is using it! :)

You've guessed the problem correctly. Every frame, if the player is moving, the code sets the animation back to the walking anim for the direction he is going. I would suggest using a boolean (such as Punching?) that is set to true when the punch key is pressed, then set to false after 0.2 seconds (or whatever amount you need). Then you could switch the anim back to the walking anim only if Punching? is false. Hope this helps!
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

nickquest

  • Posts: 60
Thanks! Yest that fixed it right up.

The Z order blocks are very useful! I can't stand it when things overlap in ways they shouldn't.