I'm developing a game. I'm really new in java and researched google: why does an int when added, keeps on adding java
Most of the times, it always adds even:
STOP_DAMAGE+=1;
Even sometimes, it subtract till negative. I'm annoyed. Sometimes it doesn't add too much. I do not understand. Here is my code:
if(isPressed==true) {
if(STOP_DAMAGE<=5) {
if(WAIT_DAMAGE>=3000) {
ENEMY_SHIP_HEALTH-=SHIP_DAMAGE_ENEMY;
STOP_DAMAGE+=1;
}
}
}
for(;WAIT_DAMAGE>=3003;) {
WAIT_DAMAGE-=WAIT_DAMAGE;//time is deducted
}
//WAIT_DAMAGE is a time int