How to change sprite animation on key press.

Get help using Construct 2

Post » Fri Aug 31, 2012 9:08 pm

Hello. I'm trying to make my player sprite change from 1 animation to another when arrow down is pressed (like a morph).



I'm super new to construct, sometimes I find that my old "logic" doesn't seem to work the same way as it would do somewhere else (perhaps I just need to learn how the stuff exactly behaves).

Could anyone be so kind to point me to a tutorial (couldn't find any) or could anyone explain me what am I doing wrong?

Thank you very much!
B
13
S
1
Posts: 22
Reputation: 1,896

Post » Fri Aug 31, 2012 9:14 pm

try this one : change the condition on event 4 to : pressed down arrow
B
52
S
15
G
7
Posts: 795
Reputation: 12,770

Post » Fri Aug 31, 2012 9:21 pm

If you don't need that BRFlag variable for something else, you can delete event 5 - 9

And on event 4 do:

On down arrow pressed - > Set animation to jugador.AnimationName = "sr" ? "sb" : "sr"

that should do the trick ^^


Edit: Well I realized that for someone new to C2 it may be a bit too difficult, so i made you a capx file

change one animation to anothershinkan2012-08-31 21:24:43
ImageImageImageImage
B
156
S
64
G
41
Posts: 2,589
Reputation: 34,603

Post » Fri Aug 31, 2012 9:52 pm

Thank you very much shinkan, that works (and at the same time I learned about conditional ? true : false).
B
13
S
1
Posts: 22
Reputation: 1,896


Return to How do I....?

Who is online

Users browsing this forum: Kitsune42k, plinkie and 2 guests