%-question or perhaps it's a forum question...
I encounter the exact problem that is mentioned in this topic. In the game I'm making, every 100 points a heart should be rewarded. So I found this majorly helpful post about the %-function and I'm already a big fan. However, using gameScore%100 = 0, set attr.hearts to attr.hearts +1 doesn't work, because it skips 100, 200, 300, etc if the points awarded for a level + total gameScore isn't exactly a multiplication of 100. I could change it to a way in which points are added to total gameScore in the level itsself, but awarded points vary between 5 and 10, which makes it still possible to go from 95 to 105. I guess incrementing the score by 5 two times instead of 10 should fix this problem, but I'm curious if there's a simpler way.
Now, in the first topic I mentioned, the last comment of the user asking the question leads me to think that TSB has given a great solution to this problem, but I can't find it in that topic or anywhere else for that matter. Anyone that can answer this question for me is kindly invited to write it down here, but if you happen to know that I just didn't look good enough for the already given answer by TSB, a link to that answer should suffice.
Comments
Create an integer attribute called game.lastGoal and set its value to 100.
When attribute game.score ≥ game.lastGoal
Change attribute game.hearts to game.hearts + 1
Change attribute game.lastGoal to game.lastGoal + 100
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Heh, it seems so obvious once you know what to do. I have actors with the most complicated loops through multiple tables that work just fine, but I lack the finesse for these kind of simple, but effective rules.
At least I know where my learning process is going. Less = more!
Thanks again, tatiang!
You're welcome. No worries! I've been doing this for years so it's a little easier to see the patterns and know what to do for a certain situation.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User