How do I make money in my app?

ashapiro914ashapiro914 Member Posts: 88
edited November -1 in Working with GS (Mac)
Hi, I am making an app and when the score reaches 50 I neede the money to go to 1. I can't seem to make it work. Right now I have,
Rule atrribute game.money=50 change attribute to money to money+1. Then I have a display text, game.money. It goes up to 1 then the score keeps going but the money stops going higher.
Any help would be appreicated.
Thanks,
Aaron

Comments

  • BlackbirdStudiosBlackbirdStudios Member Posts: 493
    The problem here is that your attribute only accounts for the first time the score hits 50, not every 50 points.

    You could say that game.money = game.score/50, but there is probably an easier way to do it, and I'll get back to you if I figure it out.

    Cheers

    -Matt
  • bluebyu25bluebyu25 Member Posts: 500
    If you are saying you want your money to go up by 1 every 50 points then you need to do this:

    Make a self.attribute called plus1 or whatever. Then say when game.score > or = plus1 then:

    Change money to money +1
    Change plus1to plus1+ 50

    You need to do this because you want the event to trigger every 50 points, and this way to self attribute will always equal multiples of 50.

    Hope that helps.
  • ashapiro914ashapiro914 Member Posts: 88
    Could you make a video or something because I don't quite understand?
  • SinequanonSinequanon Member Posts: 35
    (I'm going to make up a couple of terms here)

    If you want the money to go up by one every time the score hits 50, and then you're clearing the score down, have a rule that says:

    When score >= 50:
    Change attribute: money = money+1
    Change attribute: score = score%50 (this will set the score to the remainder, so if you ended up with 54, then the score becomes 4.

    If you want the money to follow the score (i.e. you have 250 score so you have 5 money), then try the following:

    When score >= 50+50*money
    Change attribute: money = money+1

    This gives when money = 0, we're waiting for the score to get greater than/equal to 50, when money = 1, we're waiting for 100 score and so on. If the money can be spent, then track a "moneyMax" and use that in the 50+50*money expression instead and increment both money and moneyMax in your behavior (you would only modify this moneyMax attribute when you reset the scene/game).
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Heres a video

Sign In or Register to comment.