How do I keep the level bar from adding extra points?

Ok guys, this is an issue that appeared out of nowhere.
I have an app where you have a "level" bar because you can level up.
I have a button set to the following:
On release-if level=0 add 100pts
On release-if level=1 add 50pts
On release-if level=2 add 25pts
Then my level bar states:
If score > 100 then set bar score=0
This used to work juuuust dandy, until one day, out of nowhere it would
add the value of the next level, so now what happens is that once you
go from level 0 to 1, you gain 50pts automatically which is the value added IF you press
the button. Then when you go from level 1 to 2 the bar adds the value of the next level, 2.
So instead of going from 100 to 0, it goes from 100 to 0 + whatever amount the next level is
if you press the button.
I also have another bar that is smaller which works the exact same way, I copied and
pasted all of its commands and it works fine. it goes to zero after each level without any
extra pts.
I have an app where you have a "level" bar because you can level up.
I have a button set to the following:
On release-if level=0 add 100pts
On release-if level=1 add 50pts
On release-if level=2 add 25pts
Then my level bar states:
If score > 100 then set bar score=0
This used to work juuuust dandy, until one day, out of nowhere it would
add the value of the next level, so now what happens is that once you
go from level 0 to 1, you gain 50pts automatically which is the value added IF you press
the button. Then when you go from level 1 to 2 the bar adds the value of the next level, 2.
So instead of going from 100 to 0, it goes from 100 to 0 + whatever amount the next level is
if you press the button.
I also have another bar that is smaller which works the exact same way, I copied and
pasted all of its commands and it works fine. it goes to zero after each level without any
extra pts.
Best Answer
-
tatiang Posts: 11,949
Can you post your game file or send it to me in a PM and I'll help you fix it?New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
To resolve this, you need to give your level conditions a break so that they don't fire immediately when a new level starts. To do this, I added a game attribute called game.LevelUpDelay, a boolean. I added the condition that game.LevelUpDelay is false to the rule that checks if game.song1Level=0, =1, =2, etc. So instead of just When touch is pressed, it now says When ALL conditions are valid: touch is pressed and game.LevelUpDelay is false [check levels]. At the end of all of those level check conditions, I added change attribute game.LevelUpDelay to true and then a Timer that after 0.1 seconds (run to completion checked) change attribute game.LevelUpDelay to false. That seems to work. If it gives you any problems, just increase the Timer to 0.2 or longer to give your rules enough time to fire individually. It just means that the person using the app can't click practice points until 0.2 seconds has passed again.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User