Hey guys so I am wondering if this is possible. So in my game I have it set up to where if they make a point the score goes up by 5. I implemented a multiplier in the game so if they dont get hit and continue making points then the score could increase by 10,15, and 20 depending on if they get hit or not of course.
I have my Difficulty updater using a modulus to track every score interval of 100 then increase the difficulty. The PROBLEM I am having is if they have a multiplier at the time and instead of getting 100 they get 105 the modulus doesnt take that into consideration and the function is never called.
Here is how I have it set up:
private function udpateDifficutlyModulus():void
{
if (nScore % 100 == 0 && nScore > 0)
{
seagullNumber -= 0.5
eelNumber -= 0.5
trace("Update Modulus difficulty");
addBombs();
}
}
Now this works fine if they score is divisible by 100 but like I stated before sometimes its 105 or 115 etc...
I think I have to check somehow if the score is odd or even and greater than 100? I just don't know how I would go about doing that? \
Any help of course will be appreciated! Thanks!
I think the way you've framed the question may not actually fit well with your problem. If you want to know each time your score passes a 100 increment, you could simply do this:
// represents current hundreds (1=100, 2=200, etc)
private var currentLevel:int = 0;
// each time score changes
private function checkCurrentLevel():void {
var newLevel:int = score / 100;
if(newLevel > currentLevel){
// do difficulty increment
currentLevel = newLevel;
}
}