Actor moving with integer

efishefish Member Posts: 40
edited November -1 in Working with GS (Mac)
I want an actor to move upward a specified step when the gamescore integer gets "+5". What would be the best way to do this? Thank you very much!

Comments

  • efishefish Member Posts: 40
    I'll try to formulate it a little bit easier.
    Any time the highscore reaches any number ending with 5 (5,15,25..) something happens to another actor.
    I have tried all night long to figure this out, but I just can't get it. Thanks
  • firemaplegamesfiremaplegames Member Posts: 3,211
    You'll want to use the modulus operator. It is the percent sign (%).
    In your case, you are looking for the remainder to be zero when you divide your high score by 5.

    Create an global integer Attribute called "myRemainder" (without quotes).

    Any time the high score changes, change this attribute like so:

    [high score has just changed]
    Change Attribute game.myRemainder To: game.highscore%5

    Then add a Rule in the actor that reacts to this change:

    Rule
    When game.myRemainder = 0
    Do something...

    Hope this helps!

    Joe

    @TSB: Yes, sort of close... but as they say, "close" only counts in horseshoes and hand grenades... :0)
  • efishefish Member Posts: 40
    Thank you very much for both your replies. That sounds good.
    Could you just verify where I should put
    "Change Attribute game.myRemainder To: game.highscore%5"?
    I'm still new to this, but starting to get the hang of it. Thanks again.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Wherever you are changing the score, put that behavior right after it.
  • efishefish Member Posts: 40
    Great it worked! The reason why I had some problems was because the myRemainder integer was 0 which triggered the actor right a way. I changed it to 1 and now it seems to be working fine. Thank you very much. Much appreciated.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    oops, I forgot to mention that. Glad you got it working!
Sign In or Register to comment.