How do I change from Run animation to Idle Smoothly?

Get help using Construct 2

Post » Fri Apr 10, 2015 8:12 pm

Hi,
I would like to make a seamless transition between end of RUN animation and beginning of IDLE animation.
I've already made the opposite (from IDLE > IDLE to RUN > RUN), but the other way around is more complex from what I'm thinking.

I was thinking like if current frame from RUN is playing + then go to specific frame of TRANSITIONtoIDLE then IDLE.
Something like that.

Any help or .capx examples?
Thanks! :shock:
B
5
S
1
Posts: 42
Reputation: 471

Post » Fri Apr 10, 2015 8:31 pm

One thing I've done in the past (which you may have already tried): if the RUN animation isn't too long (less than half a sec before it loops), you could wait until it reaches its beginning (transitional) frame before stopping.

For example:
-- If Player is Stopped & RUN is Playing & RUN animation frame is 0
---- Set animation to STOPPED

The issue with this is that he'll run a little in place before he becomes truly idle. The longer your run animation, the worse it'll look. Often times, you'll have multiple identical (or similar) frames in your RUN animation. If so, you can improve the result by testing to see if it's any of these frames rather than just the first one. If your player has deceleration (i.e He gradually comes to a stop when there's no input), then this could look pretty decent if you start the transition while he's slowing down.

A more complex approach (just throwing it out there, don't know if it'll look good) would be to locate an appropriate transitional frame, and then animate the character towards that frame. For example, if the character's walk is 10 frames long, but he is two frames past the ideal transitional frame, reverse the animation, and then stop it once he's at the right frame. If, on the other hand, he is 8 frames in, let it play out until it loops. Find the closest distance and change the animation accordingly.

Don't know if that gives you any ideas at all :P
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri Apr 10, 2015 9:12 pm

Thanks for the ideas!
I'll see what I can do
B
5
S
1
Posts: 42
Reputation: 471

Post » Fri Apr 10, 2015 11:00 pm

you can have your player with 4 animations:

-idle - looping idle animation.
-idletorun - a couple of frames where you start to run
-running - looping while running
-runingtoIdle - couple of frames from running to idling

or if you want to do it hardcore way - gradually slow down running animation, it will look like you move slower and slower, and then swap to idle. though this will require only 2 animations it will look way worse.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455

Post » Mon Apr 13, 2015 9:06 pm

Thanks saiyadjin, I'l try that
B
5
S
1
Posts: 42
Reputation: 471


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests