How do I make Sleep animation

Get help using Construct 2

Post » Fri Apr 07, 2017 10:52 pm

Hi i need to know how make sleep animation when me character wait to long on one place sound simple but i dont know how to do this really thank u for help!
B
11
S
3
Posts: 55
Reputation: 815

Post » Sat Apr 08, 2017 2:57 am

probably lots of ways. One way I could think of is to have an idle timer set in a variable which activates when the character stops moving and increases by 1 every second, then compare that in an event. If it reaches a certain number (thinking in seconds and however long you want it to wait), then set animation to the sleeping loop.

when the character moves, that variable just needs to be set back to zero.
B
13
S
3
Posts: 28
Reputation: 781

Post » Sat Apr 08, 2017 6:09 am

Like LukeW said... Make an event simply adds 1 to a "idletime" variable every second. Have another event that conditions to idletime>=(time in sec you want) then action out to whatever animation you want.
In your movement events simply add a set idletime=0 after each use.

What will happen is the first event will always try to count idletime up while any movement will always reset it to 0. The second condition will be constantly testing if idletime is greater or equal to your sleep time you decided. As soon as it does that event will trigger whatever sleep junk/animations you action out from the event.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Sat Apr 08, 2017 8:48 am

Ok thanks!
B
11
S
3
Posts: 55
Reputation: 815


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests