Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Deleting old character when new character spawns

eligameseligames Posts: 40Member, PRO

I spawn the same actor after 20 seconds. The old one moves off the screen. Is there anyway to make it so that only one prototype of the same character can be alive at one time. Like when spawn, delete old actor.


  • pHghostpHghost London, UKPosts: 2,289Member

    Make an index game attribute called actor_recycle, set to 0.

    In the actor, make the following the first action.

    Change Attribute: actor_recycle to: 1

    Second one in a timer.

    After 5 seconds, Change Attribute: actor_recycle to: 0

    Third a rule:

    If: self.Time is bigger (>) 8 AND actor_recycle is (=) 1 then:

    Destroy Actor

    This way, every time an actor of that type is born, all instance of that actor older than 8 seconds will get destroyed.

Sign In or Register to comment.