How do I make money in my app?
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
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
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
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.
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).