Event for animation SOLVED

Get help using Construct 2

Post » Fri Sep 21, 2012 9:56 pm

my animation have 5 frames, I want do something like that when bullet hits sprite, sprite display next or previous frame. Maybe in 'Animations' should be new action 'go to next frame' (?)delgado2012-09-23 20:08:04
B
99
S
22
G
37
Posts: 1,867
Reputation: 29,973

Post » Sat Sep 22, 2012 12:25 am

@delgado you could do something like:

    + bullet sprite-> On collision with (the sprite you want)
        -(The sprite you want)-> Set frame (The Frame you want)
B
50
S
11
G
8
Posts: 479
Reputation: 9,916

Post » Sat Sep 22, 2012 12:29 am

No problem, just make sure that that paticular animation has an 'animation speed' of 0 (so when you set to a frame in that animation the rest dont play).

Then when the bullet hits the character use 'set frame' to whichever you like.

If you had another variable like "DamageTaken", you could set the frame to 0 +Player.DamageTaken

(0 +the number of damage taken).
ImageImage
B
88
S
18
G
6
Posts: 1,048
Reputation: 11,128

Post » Sat Sep 22, 2012 12:29 am

@wink but every i hit the sprite automatically he should go to next/previous frame.

I try set frame +1 (dont work) at the moment only way is to do when frame is 0 and bullet hit sprite go to frame 1, when frame is 1 and bullet hit sprite go to frame 2 etc etc

Maybe Ashley going to do auto next / previous framedelgado2012-09-22 00:32:42
B
99
S
22
G
37
Posts: 1,867
Reputation: 29,973

Post » Sat Sep 22, 2012 12:44 am

Ya, I didn't try it but it seemed like it might work. Did you try GenkiGenga's idea that sounds better than mine.
B
50
S
11
G
8
Posts: 479
Reputation: 9,916

Post » Sat Sep 22, 2012 12:54 am

i try soon but i must first translate words from english to polish ;p
B
99
S
22
G
37
Posts: 1,867
Reputation: 29,973

Post » Sat Sep 22, 2012 3:06 am

[QUOTE=delgado] @wink but every i hit the sprite automatically he should go to next/previous frame.

I try set frame +1 (dont work) at the moment only way is to do when frame is 0 and bullet hit sprite go to frame 1, when frame is 1 and bullet hit sprite go to frame 2 etc etc

Maybe Ashley going to do auto next / previous frame[/QUOTE]
Sprite: Set animation frame to Sprite.AnimationFrame +1

or

Sprite: Set animation frame to Sprite.AnimationFrame -1
shinkan2012-09-22 03:06:59
ImageImageImageImage
B
147
S
58
G
38
Posts: 2,557
Reputation: 32,526

Post » Sat Sep 22, 2012 10:32 pm

Thanks shinkan that works :)
B
99
S
22
G
37
Posts: 1,867
Reputation: 29,973

Post » Mon Nov 05, 2012 4:10 pm

[QUOTE=shinkan]
Sprite: Set animation frame to Sprite.AnimationFrame +1

or

Sprite: Set animation frame to Sprite.AnimationFrame -1
[/QUOTE]

Thank you very much.
B
67
S
13
G
2
Posts: 987
Reputation: 6,835


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests