Destroy actor a few seconds after it gets off-scene?

ChakkuChakku Member Posts: 1,513
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

Best Answers

  • Braydon_SFXBraydon_SFX Posts: 9,273
    edited December 2012 Accepted Answer
    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_cjamie_c ImagineLabs.rocks Posts: 5,772
    Accepted Answer
    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.

  • SlickZeroSlickZero Houston, TexasPosts: 2,870
    Accepted Answer
    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

Sign In or Register to comment.