Fixed static variables impacting rounds launched after another

This commit is contained in:
François Autin 2021-06-25 18:33:41 +02:00
parent 0c2eb7acea
commit 3799a7549b

View File

@ -45,12 +45,12 @@ public class match {
/**
* the number of inputs read for each character, a.k.a. for how many frames the inputs are saved in memory.
*/
private static final int inputBufferSize = 120;
private final static int inputBufferSize = 120;
/**
* the level of the "ground", used to determine if a character is in the air or not.
*/
private static final int groundLevel = 180;
private final static int groundLevel = 180;
private static int timer;
private static InputBuffer inputsP1, inputsP2;
@ -208,6 +208,19 @@ public class match {
}
public static void main(String[] args) throws Exception {
timer = 0;
timeStamp1 = 0;
timeStamp2 = 0;
frameCount = 0;
oldPosXp1 = 0;
oldPosXp2 = 0;
oldPosYp1 = 0;
acCode = 0;
roundCounter = 0;
roundsWonP1 = 0;
roundsWonP2 = 0;
parse();
engine = new Engine(width, height, fullscreen, new Vector3f(4.0f, 3.0f));
engine.init();
@ -321,7 +334,7 @@ public class match {
//Stage
leftBoundary = (int) background.getXPos();
rightBoundary = (int) (background.getXPos() + background.getWidth() * background.getScalingFactor());
while(frameCount < 5940 && engine.getRunning()) {
ac(acCode);
if(engine.shouldClose()) engine.setRunning(false);