how to animate character when decelerating

Just started using Construct 2? Post your questions here

Post » Fri Sep 12, 2014 3:59 pm

hola
as showing sprite animation when platform is in slowdown
B
8
S
1
Posts: 34
Reputation: 420

Post » Fri Sep 12, 2014 5:29 pm

What is your question? Don't understand your question
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753

Post » Fri Sep 12, 2014 6:10 pm

how to display animation
when platform is in slowdown
B
8
S
1
Posts: 34
Reputation: 420

Post » Fri Sep 12, 2014 6:11 pm

how to display animation
when character platform is in desceleration
B
8
S
1
Posts: 34
Reputation: 420

Post » Sun Sep 14, 2014 9:36 am

If I understand correctly you would like to know if the speed is decreasing, to play a different animation..

You could give the player sprite a varaiable Lastspeed and every x seconds check if this last speed is higher than current speed

system every x seconds
system compare two values player.lastspeed > player.speed
player animation deceleration is not playing
- player set animation to deceleration

and add an event AFTER this one to set player.lastspeed to player.speed
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Sep 14, 2014 4:58 pm

do not know much but I managed to do something thanks for your reply
B
8
S
1
Posts: 34
Reputation: 420

Post » Mon Sep 15, 2014 3:23 pm

Also, if you're wanting it to change on deceleration that occurs after movement, all you need to check is it any of your movement keys are released using a Keyboard check, and if so, then play the deceleration animation for the object you want to animate.
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 » Mon Sep 15, 2014 5:58 pm

hello
achieved on key released do animation plays but it works only after releasing the key to not follow the animation

i am using the platform for player behavior
on release of the button which says the deceleration little stain could be useful starting
but I do not understand
 
thanks for the help
B
8
S
1
Posts: 34
Reputation: 420

Post » Mon Sep 15, 2014 6:13 pm

It may be a little more advanced, but you know the maximum speed of your character--you set that on the Platformer properties. I would just compare the player's Vector X (it is a platformer event). If it is greater than, say, 10 or something small AND the player is not holding a movement button, play your deceleration animation. This way, it will play it at the right time and for the right duration.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Mon Sep 15, 2014 6:26 pm

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
[b]Andrew Donelson[b]
Nlaak Studios, LLC
https://www.nlaak.com/
[email protected]
B
15
S
3
Posts: 66
Reputation: 1,136

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: Obi554 and 1 guest