How do I return to the revious playin animation

Get help using Construct 2

Post » Mon Mar 04, 2013 4:33 am

Hi

Im 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.


http://s9.postimage.org/wt301jukv/Screenshot_178.png

The function PlayerForwardAttack is called when the spacebar is pressed.

So far Im thinking of a couple of ways to return the animation to running, but Im thinking Im 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.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Mar 04, 2013 5:07 am

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.
B
6
S
1
Posts: 67
Reputation: 986


Return to How do I....?

Who is online

Users browsing this forum: Khamsou and 15 guests