After An Integer, Change Boolean To True Every 100

Hey GS,

Thanks in advance for your help! So I tried a few things including mod and no luck with getting it to work. Just ended up breaking my game, LOL. Will try and explain what I am trying to accomplish.

I have a game.level integer that =1 and it basically says after 30 seconds change game.level to 2.

In the game I have a score that says every 1 second change game.score to game.score+1

What I am trying to accomplish is when game.level =2
and
when game.score hits every 100 change game.boolean to true

So lets say game.level changes to 2 when game.score is 136, then every 100 starting from 136 should change the game.boolean to true. So game.boolean would change to true at 236, 336, 436, 536...

Hopefully that makes sense what I am trying to accomplish! LOL

Comments

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

    Change attribute game.nextScore to game.score+100
    When game.score=game.nextScore
    Change attribute game.boolean to true
    Change attribute game.nextScore to game.score+100

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

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    Dang you @tatiang‌,

    The one time I try to think of a more complex yet simplified way of doing this, it deceives me due to it being a simple answer! Thank you. Sometimes the simple answer is right in front of your face but you are blinded by the more complicated answers!

    HAHAHAHA

    Thanks again!

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

    Heh. You're welcome. ;)

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

  • MarcMySaladMarcMySalad Member Posts: 158

    An alternative solution just cause I like it a bit on the fancier side :wink:

    change attribute self.checkScoreInteger to mod(game.score,100)
    when self.checkScoreInteger is 0 then change attribute yourBoolean to true otherwise change attribute yourBoolean to false

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

    @MarcMySalad true, you could use When mod(game.score,100)=36 ...

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

Sign In or Register to comment.