Start animation and destroy actor after 1 second
Jugoslav85
Member, PRO Posts: 36
Hi, i have a spawned actors which are moving on the scene toward the center. While they are moving they have 4 frames of animation. I have set up a rule, When Touch is Pressed, Animate (other Death animation of 4 frames), in the same rule i also have timer After 1 second Destroy Actor.
The problem is, when i press on the actor, he shows up a frame of the death animation (for part of the second) and continue with his moving animation.
How should i make the actor change the animation to the Death Animations and Destroy after the animation is done (lets say 1 second).
Best Answer
-
Socks London, UK.Posts: 12,822
@Jugoslav85 said:
I did, and it does affect them all.You are probably using a game.attribute rather than a self.attribute, it does work if set up correctly.
Answers
I expect as soon as you release your finger (or the actor moves so that it is no longer under your finger?) the death animation stops as you are telling it to only play whilst (not after) touch is pressed.
Make a Boolean attribute, call it KillMeWhyDontYou.
Make a rule in the actor that reads:
When touch is pressed change KillMeWhyDontYou to true.
Make another rule that reads:
When KillMeWhyDontYou is true do the death animation.
. . . . . . .
In this set-up the thing that triggers the death animation is KillMeWhyDontYou being true, which once switched on by being touched, is not then switched off when your finger is released.
Here is what i thought. When Touch is Pressed - Animate (this rule only true when you keep pressing down. When you press and released your figure, this action is even less than a second that's why you only see the dead image after 1 second where the second behavior is true.
You can try to create a boolean attribute - Animation. First rule, when touch is press, change attribute animation to true After 1 second, Animation = False.
Then create a second rule, when Animation = true, your 4 frames of animation, Otherwise: dead image.
Let's me know if it works
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
The Problem is that this affects all my spawned actors. So once i press on one, all of them are changing to animation.
Same here. It affects all my spawned actors.
No, it doesn't, try it.
Sorry i missed reading the part you said spawn actors. I thought it was just 1 actor. In this case, same method, but you will need to add 1 more condition to the second rule: Actor receives event:touch is pressed. This will make only the spawn actor that pressed will change. Let me know if it works this time.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
I did, and it does affect them all.
Now, it does not affect the other actors, but when i release the button, it goes back to the moving animation as it was before making the boolean attributes.
>
Thanks for the tip, i change the game attribute to self attribute and now it affects only the touched actor. There is an other problem now. For some reason, it mixes the death animation with the moving animation when the touch is pressed. Any solution on that one ?
The rules and behaviours and actions and attributes that are making your project behave as it does all on the monitor infront of you - you can see all these rules - but no one else can, so it's not going to be easy to offer suggestions ("For some reason" is not really enough information).
I have a calculation, it should come to 243, but it keeps coming to 283, I'm not going to show you any of the numbers or processes involved in the calculation but can you help me work out where I am going wrong ?
It is ok, i managed it somehow. I had to make an other boolean attribute which will stop the moving animation, and in the same time it will begin the death animation.
Thanks for your tips, i couldn't have done it without your help.