Destroy actor a few seconds after it gets off-scene?
Is there a simple way to make a rule that destroys the actor (my main actor) a few seconds after it leaves the scene area? Rather than having invisible boundary actors, is there a rule that I can make that destroys the actor after, say, 3 seconds once it leaves scene area?
This is likely a very easy answer for people that are familiar with GameSalad.
Thanks
This is likely a very easy answer for people that are familiar with GameSalad.
Thanks
Best Answers
-
Braydon_SFX Posts: 9,273
Hi there,
Create a rule in your actor - when attribute self.position X is equal or greater than 500 (or Y depending on what you want)
Timer, after 3 seconds
Destroy.
Hope this makes sense. I not, I'll do a demo file for you.
-
jamie_c ImagineLabs.rocks Posts: 5,772
You could check the actors X and Y locations and destroy that actor once it/they reach a certain number.
Something like this if you were setting up a game for the iPhone:
Rule:
When Attribute Player Self Position X > 320
Timer:
After 3 Seconds -> Destroy this actor
This would destroy the actor 3 seconds after it reaches the right edge of the screen.
-
SlickZero Houston, TexasPosts: 2,870
Yes. Even though the actor will destroy itself once it leaves the game area, you could use a "Timer" and a "Destroy" behavior inside a rule.
You may need another invisible actor to let the program know that it is going off screen, or you could use it's position to determine when to fire off the rule. For example, if you wanted to destroy it 3 seconds after it moves off the right side of the screen.
Rule: When self.position x is > 360
Timer: after 3 seconds
Destroy "actor"
But like I said, if you just keep it moving in whatever direction off screen, it will destroy itself after it leaves the game area.
Answers
Pretty funny how each post is just a bit longer than the one above it, explaining the time differential!
Thanks guys, it works!