Deleting old character when new character spawns

eligameseligames Member, PRO Posts: 40

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.

Comments

  • pHghostpHghost London, UKMember Posts: 2,342

    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.