How do I make an animation stay after collission

Get help using Construct 2

Post » Tue Oct 06, 2015 5:39 am

Hello all :D , I'm with a little problem on creating my HUD for my game.On my HUD I have a character head, and I want that for example, after colliding with anything that deals damage, it shows a sad face, when it dies another face and when colliding ( pickink up ) a coin and killing a monster it shows a happy face.
I have already the animations, its simple ones with just 1 frame, i tested it on many ways and or the animation of the collisions stay forever and do not turn back into the default, or when I collide it happens so fast that you almost cant see it. So... I want to know how can I put an animation when it collides, and only change back to the default after 1 or maybe 2 seconds. Thank you, have a good day/night :)
B
3
Posts: 1
Reputation: 177

Post » Wed Oct 07, 2015 2:40 am

Hey there!

So I'm not 100% sure how you've got your stuff set up, but you could always try something like:

player>on collision with object
set animation > "happy"
Wait 1 second
Set animation to normal

Depending on how you are making your player, there could be other ways to do this. For now I think this will work.
B
71
S
41
G
24
Posts: 356
Reputation: 18,464

Post » Wed Oct 07, 2015 3:06 am

Open the sprite editor, set Speed to 0, and loop to NO, and repete to 0.

When you want to change the frame, just use the "set frame" in the sprites animation action.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 07, 2015 8:07 am

I'd suggest adding the timer behaviour, could be usefull for many more features

Then you could make these events:

on timer "changeback"
> set the face to default

on collision
> set face to whatever
> start timer "changeback for 2.5" seconds

Something like this should work..
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


Return to How do I....?

Who is online

Users browsing this forum: draiza, R0J0hound and 1 guest