How to trigger the animation after making an object diappear?

Hi. I have some problems with the animation.
It looks like that: The player press the button Use pepper_spray.
The animation pepper_spray appears for a 2 seconds and disappears.
I want to hide the character ‘recorder’ in the same moment when the pepper_spray dust animation will hide and show/play another animation of the ‘recorder’ walking away. But that second animation does not appear.

Where did I make a mistake?

1st of all
You are checking SCENE timer where you are deleting and starting object timer

How it can get above 3 when you delete it at 2?

Hi,

in your third event block you are subtracting 0 from the variable sprayActive instead of setting it to 0 (if there are only two states you could just make it a boolean variable).
Do you have a scene-timer called ‘Smoke1’? Obviously you have an object timer ‘Smoke1’ for the object pepper_spray but in your conditions a scene timer is checked for the 2 and 3 seconds.

And if both are the same for you (which is not working) then Zero is right that you should not delete the timer if you need a larger time value of the same timer for another event.

Thanks, ok, so I’ve tidied up my workflow a bit.

My aim is to hide an object ‘recorder’ and show the animation recorderOut-anim once. I don’t understand what condition should I use for that.

You want to hide object and show it?
I do not get it?

I mean you want to hide object and show its animation
You can’t do that when its hidden so i do not get what you mean?

No no. I have a sprite with a character. When I press the button pepper_spray there appear a cloud animation. After 2 seconds of the cloud animation that character should disappear with the dust object. And in the place of this character should appear the same figure going out aside as after hitting. So that the player can see that he eliminated the opponent, the picture of the opponent disappears and at the same time his animation appears, in which he turns and goes away.

I am not sure i get it correctly so correct me if im wrong

You press some button
Can object changes its animation to spraying which includes cloud of dust (or can and dust are separate objects?)
After 2 secs can and dust disappear and enemy that was sprayed shows FOR EXAMPLE explosion animation then drops on the floor?

Yes, something like that. It is as if you had a ship and you press the button “bomb” and you see the animation of the explosion and when this animation stops, then the ship is slowly sinking. So, you have 3 elements: the sprite with the ship + the animation of the explosion + animation of the sinking ship. And I just want to make it that way.

Thanks, I will try that.

Ok, I did it in a slightly different way, but can you tell me how to hide/delete animation after play once?

I have in actions Hide and Delete ‘recorder_out’ and it disappear but at once, but it needs to diappead after playing the whole animation once.

Condition
Animation of object is YourAnimationName
Animation is finished

Action
Delete object

1 Like

Ok I got it, many thanks :slight_smile:

1 Like