How do I trigger a custom animation when the player is idle?

0 favourites
  • 3 posts
From the Asset Store
Player's Follower
$7 USD
30% off
Players follower. use it for anything which follows the player
  • Hi,

    I want to make the player character to play a custom animation only when the player is idle let's say, after 5 seconds the player has been idle, without moving.

    If you move the player the custom animation should dissapear.

    I've tried different methods without success. The problem is the "wait" event. it triggers the animation even after I've moved the player.

    Any suggestions? I've attached my events sheet.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One work around:

    Make a global variable called something like TimeSincePressed, have it increment (using Add to variable) 1 per second (using Every X Seconds) and reset it to 0 each time a movement or jump key is pressed and also when it is released (since it is very unlikely someone would move in a direction on a platformer continually for over 5 seconds.. if so you have some serious boring gameplay ). Have your Idle event not do a wait but simply check every tick for the value of TimeSincePressed and if greater than or equal to 5 then fire it off and if lower ignore via a return in else statement.

  • It worked!

    Thanks!

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