Play an idle animation after X seconds

Get help using Construct 2

Post » Sun Apr 14, 2013 12:38 pm

Hey all. I'm new to Construct 2 and have been playing around with platform movement and animation for the past week or so, having done the very useful tutorial.

I've encountered a few issues that I've managed to iron out by myself, such as stopping the player from mirroring the sprite the wrong way by pressing left and right at the same time etc.

The basics are all very intuitive, but I'm struggling with making a second idle animation that plays when the player hasn't moved for 2 seconds. I've been trying to use the Wait action.

Here's my prototype:

My event sheet:

At the beginning, I thought I could simply do this:
If the player is not moving & is on the floor = Wait for 2 seconds, then Set animation to "IdleTap" (my foot-tapping animation). Then reset the animation when the player moves/jumps.

This caused all sorts of problems, as the IdleTap animation would trigger when the player was moving -- I think this is because the Wait command is executed every 2 seconds while those conditions are being met, and it was trying to trigger the queued-up animations even after the player had started moving.

So I added a global variable to try and make sure the Wait action only ran once, but now it seems to trigger my "push" (moving) animation randomly as well as when you jump from an idle position.

Any help would be greatly appreciated. Thanks.
Posts: 3
Reputation: 431

Post » Sun Apr 14, 2013 2:10 pm

Hi, I've just done up a quick example - the idle state kicks in after 2 seconds and is indicated when the box turns orange. I noticed that without the "trigger once while true" condition it did not behave as expected, this may have been causing your issues.
Posts: 182
Reputation: 6,528

Post » Sat Apr 20, 2013 6:05 am

Thanks for the reply, signaljacker. I checked out your .capx and noticed that it didn't seem like it was waiting for 2 seconds to trigger the idle animation in some cases.

I implemented the "trigger once while true" condition in my game anyway, but I still have the problem that the idle animation is trying to trigger while my player is moving/jumping.
Posts: 3
Reputation: 431

Post » Sat Apr 20, 2013 6:22 am

Maybe you could give that static "Idle" animation frame a duration of 2 seconds (in the animation editor via "speed") and then 'on animation finished' set the animation to "IdleTap"?Horace Pinker2013-04-20 06:24:07
Posts: 9
Reputation: 618

Post » Sat Apr 20, 2013 6:33 am

Horace, that worked perfectly Thanks a lot.

Initially that's how I imagined doing it, but somehow I dismissed it because I was so hell-bent on learning how to use 'Wait'. Oh well, there's plenty of time for that I guess.
Posts: 3
Reputation: 431

Return to How do I....?

Who is online

Users browsing this forum: NN81, QuantumMMX and 12 guests