GameSalad

Howdy, Stranger!

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

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

sinbotsinbot Posts: 98Member, PRO
edited June 27 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 Posts: 11,793Member, Sous Chef, PRO, Senior Sous-Chef
    edited June 28

    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 Posts: 98Member, PRO

    thank you!

Sign In or Register to comment.