Help with spawns.

anthonymtaraanthonymtara Member Posts: 4
edited December 2015 in Working with GS (PC)

How do I make it so the spawn I created deletes the previous random actor every time it spawns a new random actor?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2015

    Create an integer attribute called game.spawnCount with the starting value zero. In the spawned actor, create an integer attribute called self.myCount with the starting value zero.

    In the spawner actor:

         [Rule to spawn a new actor]
              Change Attribute game.spawnCount to game.spawnCount + 1
              Spawn Actor

    In the spawned actor:

         Change Attribute self.myCount to game.spawnCount
         If attribute game.spawnCount > self.MyCount
              Destroy Actor

    Or, an easier way is to have the spawned actor spawn a new actor and then destroy itself.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • anthonymtaraanthonymtara Member Posts: 4

    Thanks

Sign In or Register to comment.