Play an idle animation after X seconds

0 favourites
  • 5 posts
From the Asset Store
This Student Workbook uses both Construct 3 & 2 encoding. It supplies client-side & php "back-end" encoding.
  • 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 scirra.com/tutorials/253/how-to-make-a-platform-game 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: lloydparker.com/game

    My event sheet:

    <img src="http://gamescrawl.com/wp-content/uploads/2013/04/game-logic.jpg" border="0" />

    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.

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

    dl.dropboxusercontent.com/u/70305965/idle.capx

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

  • 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"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Horace, that worked perfectly <img src="smileys/smiley17.gif" border="0" align="middle" /> 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.

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