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
12
S
1
Posts: 21
Reputation: 1,869

Post » Fri Aug 31, 2012 9:14 pm

try this one : change the condition on event 4 to : pressed down arrow
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

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
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

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
12
S
1
Posts: 21
Reputation: 1,869


Return to How do I....?

Who is online

Users browsing this forum: flemmig, Matthew de, semaso, Skebab, Virpoja and 13 guests