For some reason in my android game I am making I can add 2 to a value by doing
variableName += 2;
but when I do
variableName -= 2;
the variableName becomes negative for some reason when the original value of the variable is 5, here is the code I am using
if (World.collide(Assets.snowballFast, Assets.sprite1, fastballzX,
fastballzY, GameScreen.mainX, GameScreen.mainY)) {
fastballzY = random.nextInt(10000) * -1 - 1000;
fastballzX = random.nextInt(400) + 200;
World.powerUp = true;
World.fastBalls = true;
currentScore = World.score;
World.ballSpeeds[0] += 2;
World.ballSpeeds[1] += 2;
World.ballSpeeds[2] += 2;
World.ballSpeeds[3] += 2;
}
if (World.score - 10 >= currentScore) {
World.powerUp = false;
World.fastBalls = false;
World.ballSpeeds[0]-=2;
World.ballSpeeds[1]-=2;
World.ballSpeeds[2]-=2;
World.ballSpeeds[3]-=2;
}