how to animate character when decelerating

Just started using Construct 2? Post your questions here

Post » Mon Sep 15, 2014 7:03 pm

you can provide an example for better understanding
B
8
S
1
Posts: 34
Reputation: 420

Post » Tue Sep 16, 2014 2:07 am

nlaakald wrote:Great tip @inquiesco, it is always better to save CPU. By checking every tick you could very well check a few thousand times before the velocity of the character changed. But...you can't just go by input (key/touch). What if the character was moving along and ran into something in the environment (mud/NPC) that affected speed? I would expand on your inout and do it this way:

1) check for input (any)
2) yes? Slow down? Set player instance state to SLOWING
3) no continue check other inputs
...
9) if player instance state != to current state then process
10) is player SLOWING? Yes play animation and Slow

Just my 2 cents.

Actually you could just use the Siginal / Wait for signal also


Thanks @nlaakald, and you're correct, there could be blocks impeding speed, :). In that case I'd make a condition where on key release or on collision with an object and player speed is less than their max speed to play a slower animation like this:

Keyboard -> On key released
- or -
player -> On collision with slow_object
---- player -> 8Direction speed < player.8Direction.MaxSpeed
-------- Rest of events
Founder of Jadelight Studio, Developer of Libertas Aedifex, regular C2 Help contributor and fan of ambient music and Star Wars.
B
12
S
4
Posts: 255
Reputation: 2,008

Post » Tue Sep 16, 2014 6:30 am

Post your CAPX and see what I can do for you
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579

Post » Tue Sep 16, 2014 5:50 pm

Message: hippie can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
https:// http://www.dropbox.com /s/ 9lb5378i1zban37 / example.capx?dl = 0
remove space
B
8
S
1
Posts: 34
Reputation: 420

Post » Wed Sep 17, 2014 11:02 am

If it suits your application then you could just try this:

Set your "walking" animation to speed 0 then do the following

Platform is Moving --> Set Animation speed: player.Platform.Speed/5

Edit the "5" at the end to effectively control the frame rate so to say.

This will accelerate and decelerate your "walking" animation in time with your movement, but can often end with say, your characters leg half way in the air etc... It works for my purposes, but yeah, not every ones.
B
9
S
2
Posts: 26
Reputation: 586

Post » Wed Sep 17, 2014 6:04 pm

Thank you for your help
B
8
S
1
Posts: 34
Reputation: 420

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests