I am using this code to see if a users score is divisible by 20.
if(hitCount % 20 == 0){
interval = interval - 1;
Log.e("Score", "User score is divisible by 20 decreasing interval to "
+ interval);
timer.setInterval(interval);
}
The only problem is is that this code is in a IUpdate method in andengine that updates every second.
So if a user score is divisible by 20 for more than 1 second it keeps subtracting 1.
I only want it to subtract once if the user score is divisible by 20.
Any suggestions?
You could keep an external flag:
Then, in your code, set or unset it:
I see what you mean though – it does feel like a bit of a messy solution.