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 Engine engine;
|
||||
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.
|
||||
@ -192,7 +193,11 @@ public class match {
|
||||
gamepad2 = new GamepadInput(GLFW_JOYSTICK_2);
|
||||
gamepad2.inputRefresh();
|
||||
}
|
||||
ac(0);
|
||||
|
||||
while(frameCount < 5940) {
|
||||
ac(acCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -205,7 +210,7 @@ public class match {
|
||||
startNewRound();
|
||||
timeStamp1 = System.currentTimeMillis();
|
||||
frameCount = 0;
|
||||
ac(10);
|
||||
acCode = 10;
|
||||
break;
|
||||
|
||||
//checks if one or both of the chars are out of health
|
||||
@ -215,29 +220,29 @@ public class match {
|
||||
oldPosYp1 = p1.getPosY();
|
||||
oldPosYp2 = p2.getPosY();
|
||||
|
||||
if(p1.getCurrentHP() <= 0 && p2.getCurrentHP() <= 0) { ac(11);}
|
||||
else if(p1.getCurrentHP() <= 0) { ac(12);}
|
||||
else if(p2.getCurrentHP() <= 0) { ac(13);}
|
||||
else { ac(20);}
|
||||
if(p1.getCurrentHP() <= 0 && p2.getCurrentHP() <= 0) { acCode = 11;}
|
||||
else if(p1.getCurrentHP() <= 0) { acCode = 12;}
|
||||
else if(p2.getCurrentHP() <= 0) { acCode = 13;}
|
||||
else { acCode = 20;}
|
||||
break;
|
||||
|
||||
//end round
|
||||
case 11:
|
||||
endRound();
|
||||
if(roundsWonP1 >= 2||roundsWonP2 >= 2) { endMatch();} //TODO : will probably need to specify more
|
||||
else{ac(0);}
|
||||
else{acCode = 0;}
|
||||
break;
|
||||
|
||||
//if p1 is at 0 health
|
||||
case 12:
|
||||
roundsWonP2++;
|
||||
ac(11);
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
//if p2 is at 0 health
|
||||
case 13:
|
||||
roundsWonP1++;
|
||||
ac(11);
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
//read both players inputs
|
||||
@ -252,7 +257,7 @@ public class match {
|
||||
}
|
||||
handleInputs(p1, inputsP1);
|
||||
handleInputs(p2, inputsP2);
|
||||
ac(21);
|
||||
acCode = 21;
|
||||
break;
|
||||
|
||||
//start of the handling of hitboxes
|
||||
@ -264,7 +269,7 @@ public class match {
|
||||
handleHits(p1, p2, inputsP2);
|
||||
handleHits(p2, p1, inputsP1);
|
||||
}catch (IndexOutOfBoundsException e) {};
|
||||
ac(22);
|
||||
acCode = 22;
|
||||
break;
|
||||
|
||||
//Update of the current frame of each character
|
||||
@ -302,7 +307,7 @@ public class match {
|
||||
}
|
||||
engine.update();
|
||||
engine.render();
|
||||
ac(23);
|
||||
acCode = 23;
|
||||
break;
|
||||
|
||||
//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++;
|
||||
timeStamp1 = System.currentTimeMillis();
|
||||
ac(10);
|
||||
acCode=10;
|
||||
break;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user