Simplified way to make something happen a limited amount of times.

sinbotsinbot Member Posts: 232
edited June 2019 in Working with GS (Mac)

I have an actor that spawns 1x and is then collected with playable actor. Actor spawns a 2nd time right after. After this second time I need the actor to not spawn any more and a new game level attribute activate (ie. lock door opens). What might a straight forward way be to program this? Using a numeric attribute? Appreciate if someone could post an example or direct me to a tutorial that is related.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2019

    Make an integer attribute called game.spawnCount. Leave its value at zero.

    In spawner actor
    When attribute game.spawnCount<2
         Spawn actor [collectable]
         Change attribute game.spawnCount to game.spawnCount+1

    When attribute game.spawnCount=2
         Change attribute game.lockDoor to true

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

  • sinbotsinbot Member Posts: 232

    thank you!

Sign In or Register to comment.