From 3799a7549b94ccbe5aac8996cdad107781edd4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Fri, 25 Jun 2021 18:33:41 +0200 Subject: [PATCH] Fixed static variables impacting rounds launched after another --- src/main/java/gameplay/match/match.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/gameplay/match/match.java b/src/main/java/gameplay/match/match.java index 0e6c6ec..27ae659 100644 --- a/src/main/java/gameplay/match/match.java +++ b/src/main/java/gameplay/match/match.java @@ -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);