How to stop reducing life? [closed]
- by SystemNetworks
CODE
Input input = gc.getInput();
int xpos = Mouse.getX();
int ypos = Mouse.getY();
emu = "Enemy Life : " + enemyLife;
Life = "Your Life Is" + life;
Mousepos = "X:" + xpos + "Y:" + ypos;
//test
test1 = "Test INT" + test1int;
if(!repeatStop)
{
//if this button is press, the damage will add up. When
//pressed fight, it would start reducing the enemy health.
if(input.isKeyPressed(Input.KEY_1))
{
test1int += 1;
}
}
if((xpos>1007 &xpos<1297)&&(ypos>881 && ypos<971))
{
//Fight button
if(Mouse.isButtonDown(0)){
finishTurn=true;
}
}
//fight has started
if(finishTurn==true)
{
//this would reduce the enemy life
if(floodControl1==false)
{
enemyLife-=test1int;
}
//PROBLEM: Does not stop reducing!
//the below code was not successful. It did not stop it // from reducing further.
if(test1int>10)
{
floodControl1=true;
}
}
QUESTION:
Ok now, this is what is does. When I press the key, 1, it adds up the damage to the enemy. When I press fight, It will then start to reduce the enemy's health. Now my problem is, it kept on reducing and deducting it until negative! How do I deduct it to my desired damage (My desired damage is the one when press key 1)?