trying to avoid a stack overflow in ac
This commit is contained in:
parent
0c8f5743e5
commit
9779f41266
@ -61,6 +61,7 @@ public class match {
|
|||||||
private static ObjectGl objP1,objP2;
|
private static ObjectGl objP1,objP2;
|
||||||
private static Engine engine;
|
private static Engine engine;
|
||||||
private static Frame f;
|
private static Frame f;
|
||||||
|
private static int acCode = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
||||||
@ -192,7 +193,11 @@ public class match {
|
|||||||
gamepad2 = new GamepadInput(GLFW_JOYSTICK_2);
|
gamepad2 = new GamepadInput(GLFW_JOYSTICK_2);
|
||||||
gamepad2.inputRefresh();
|
gamepad2.inputRefresh();
|
||||||
}
|
}
|
||||||
ac(0);
|
|
||||||
|
while(frameCount < 5940) {
|
||||||
|
ac(acCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +210,7 @@ public class match {
|
|||||||
startNewRound();
|
startNewRound();
|
||||||
timeStamp1 = System.currentTimeMillis();
|
timeStamp1 = System.currentTimeMillis();
|
||||||
frameCount = 0;
|
frameCount = 0;
|
||||||
ac(10);
|
acCode = 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//checks if one or both of the chars are out of health
|
//checks if one or both of the chars are out of health
|
||||||
@ -215,29 +220,29 @@ public class match {
|
|||||||
oldPosYp1 = p1.getPosY();
|
oldPosYp1 = p1.getPosY();
|
||||||
oldPosYp2 = p2.getPosY();
|
oldPosYp2 = p2.getPosY();
|
||||||
|
|
||||||
if(p1.getCurrentHP() <= 0 && p2.getCurrentHP() <= 0) { ac(11);}
|
if(p1.getCurrentHP() <= 0 && p2.getCurrentHP() <= 0) { acCode = 11;}
|
||||||
else if(p1.getCurrentHP() <= 0) { ac(12);}
|
else if(p1.getCurrentHP() <= 0) { acCode = 12;}
|
||||||
else if(p2.getCurrentHP() <= 0) { ac(13);}
|
else if(p2.getCurrentHP() <= 0) { acCode = 13;}
|
||||||
else { ac(20);}
|
else { acCode = 20;}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//end round
|
//end round
|
||||||
case 11:
|
case 11:
|
||||||
endRound();
|
endRound();
|
||||||
if(roundsWonP1 >= 2||roundsWonP2 >= 2) { endMatch();} //TODO : will probably need to specify more
|
if(roundsWonP1 >= 2||roundsWonP2 >= 2) { endMatch();} //TODO : will probably need to specify more
|
||||||
else{ac(0);}
|
else{acCode = 0;}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//if p1 is at 0 health
|
//if p1 is at 0 health
|
||||||
case 12:
|
case 12:
|
||||||
roundsWonP2++;
|
roundsWonP2++;
|
||||||
ac(11);
|
acCode = 11;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//if p2 is at 0 health
|
//if p2 is at 0 health
|
||||||
case 13:
|
case 13:
|
||||||
roundsWonP1++;
|
roundsWonP1++;
|
||||||
ac(11);
|
acCode = 11;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//read both players inputs
|
//read both players inputs
|
||||||
@ -252,7 +257,7 @@ public class match {
|
|||||||
}
|
}
|
||||||
handleInputs(p1, inputsP1);
|
handleInputs(p1, inputsP1);
|
||||||
handleInputs(p2, inputsP2);
|
handleInputs(p2, inputsP2);
|
||||||
ac(21);
|
acCode = 21;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//start of the handling of hitboxes
|
//start of the handling of hitboxes
|
||||||
@ -264,7 +269,7 @@ public class match {
|
|||||||
handleHits(p1, p2, inputsP2);
|
handleHits(p1, p2, inputsP2);
|
||||||
handleHits(p2, p1, inputsP1);
|
handleHits(p2, p1, inputsP1);
|
||||||
}catch (IndexOutOfBoundsException e) {};
|
}catch (IndexOutOfBoundsException e) {};
|
||||||
ac(22);
|
acCode = 22;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Update of the current frame of each character
|
//Update of the current frame of each character
|
||||||
@ -302,7 +307,7 @@ public class match {
|
|||||||
}
|
}
|
||||||
engine.update();
|
engine.update();
|
||||||
engine.render();
|
engine.render();
|
||||||
ac(23);
|
acCode = 23;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Waits the end of 1/60th of a second since start of frame then loops back to start
|
//Waits the end of 1/60th of a second since start of frame then loops back to start
|
||||||
@ -313,7 +318,7 @@ public class match {
|
|||||||
}
|
}
|
||||||
frameCount++;
|
frameCount++;
|
||||||
timeStamp1 = System.currentTimeMillis();
|
timeStamp1 = System.currentTimeMillis();
|
||||||
ac(10);
|
acCode=10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user