How can I remove Actors from a Scene without killing them?

yelmusleh

  • Posts: 26
I will try to say this in a simple fashion.

I have these actors that appear on scene, they appear randomly.

I would like these actors to remove themselves from the scene after two seconds, basically no longer existing on the scene.

I already have something that is triggered when they are killed so I can't kill the actors after two seconds.

How can I do this?

bonechill

  • *
  • Posts: 271
recycle your actors.
Play Gold Hunter on Kongregate, Newgrounds, or Stencyl Arcade

darrigaz

  • Posts: 124
Would it work if you set up a blank animation for the actors with no collision and then gave them an attribute (something like "disappeared bool") and when you wanted them to disappear you could set the bool to true and if the bool was true you could switch their animation to the invisible no collision one.

They'd still be there so all their processes would be going and if something was broke it might be a bit tricky to debug but would it do what you want?

SadiQ

  • Posts: 1780
You could try that Draw image for actor block to hide them if you don't want to kill them...or you could move them out of the screen view...or some more ideas will probably come to somebody's mind.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.


yelmusleh

  • Posts: 26
I tried bonechills idea first and it worked if the actor was not clicked on. However, if I clicked on the actor before it dissappeared to trigger what it is suppose to, it freezes the game.

I also liked SadiQs idea, so how can I set gravity to an actor and have them fall offscreen without the scene following the actor?

Innes

  • *
  • Posts: 1963
I think I'd approach this problem by giving the actors a Boolean flag using actor values. Initially, set the flag to True which would mean that the actor is live. When you want to remove the actor from the scene, set the flag to to False (not live), then kill it.


When the actor is killed, check the flag to see if the actor is live, and if it is, carry out the appropriate action. If the flag is False, then the killing action can be ignored.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

yelmusleh

  • Posts: 26
I have got this resolved.

Thanks!