How do I return to the revious playin animation

0 favourites
  • 2 posts
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • Hi

    I?m having this problem:

    When the left arrow is pressed, my player runs left.

    When I press the spacebar, it shoots, and it plays a shooting animation.

    When the left key is pressed, and without releasing it the spacebar is pressed too, the player moves while playing the firing animation (so far, so good).

    The thing is that when that happens, and the user lets go of the spacebar but keeps holding the left arrow, the sprite is stuck on the last frame of the firing animation (it does not return to the running animation).

    Basically, this is my code.

    <img src="http://s9.postimage.org/wt301jukv/Screenshot_178.png" border="0" />

    s9.postimage.org/wt301jukv/Screenshot_178.png

    The function PlayerForwardAttack is called when the spacebar is pressed.

    So far I?m thinking of a couple of ways to return the animation to running, but I?m thinking I?m missing something really obvious. Since the Run animation is executed on the "On Player Moved" event, shouldn't it be called every time the player is moving? shouldn't it be called after the spacebar is released?

    thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • On Moved only triggers when the object initially starts to move. You want something more like Is Moving.

    In the highlighted portion after On Landed where you actually use Is Moving instead, it's still being limited by the one-off nature of On Landed before it.

    Basically, you've set every last event on there as a one-off occurrence.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)