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
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

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,911

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
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

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
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

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,911

Post » Sat Sep 22, 2012 12:54 am

i try soon but i must first translate words from english to polish ;p
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

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

Post » Sat Sep 22, 2012 10:32 pm

Thanks shinkan that works :)
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

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
65
S
13
G
2
Posts: 969
Reputation: 6,732


Return to How do I....?

Who is online

Users browsing this forum: spacedoubt and 3 guests