Merge branch 'master' of https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat.git
This commit is contained in:
commit
6576aabbc5
@ -34,6 +34,7 @@ import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.system.CallbackI;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
@ -57,7 +58,7 @@ public class match {
|
||||
|
||||
private static int timer;
|
||||
private static InputBuffer inputsP1, inputsP2;
|
||||
private static int roundsWonP1, roundsWonP2;
|
||||
private static int roundsWonP1=0, roundsWonP2=0;
|
||||
private static Character p1, p2; //characters of player 1 and 2
|
||||
|
||||
private static long timeStamp1;
|
||||
@ -94,6 +95,7 @@ public class match {
|
||||
private static Frame f;
|
||||
private static int acCode = 0;
|
||||
private static int height, width;
|
||||
private static boolean roundP1=false ;
|
||||
|
||||
/**
|
||||
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
||||
@ -104,6 +106,8 @@ public class match {
|
||||
inputsP2 = new InputBuffer(inputBufferSize);
|
||||
p1.setPos(-750, groundLevel); //TODO : change to better values if needed
|
||||
p2.setPos((int) (750 - objP2.getWidth() * objP2.getScalingFactor()), groundLevel); //TODO : change to better values if needed
|
||||
p1.setCurrentHP(p1.getMaxHP());
|
||||
p2.setCurrentHP(p2.getMaxHP());
|
||||
objP1.translate(new Vector3f(p1.getPosX(),p1.getPosY(),0));
|
||||
objP2.translate(new Vector3f(p2.getPosX(),p2.getPosY(),0));
|
||||
// TODO meilleur implémentation possible
|
||||
@ -121,7 +125,13 @@ public class match {
|
||||
* TODO : Implement this once we know what to do.
|
||||
*/
|
||||
private static void endRound() {
|
||||
|
||||
|
||||
if(roundP1) {
|
||||
System.out.println("P1 won the round");
|
||||
}
|
||||
else {
|
||||
System.out.println("P2 won the round");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,7 +140,9 @@ public class match {
|
||||
* TODO : Implement this once we know what to do.
|
||||
*/
|
||||
private static void endMatch() {
|
||||
|
||||
if (roundsWonP1 > roundsWonP2 ) {System.out.println("P1 won the match");}
|
||||
else {System.out.println("P1 won the match");}
|
||||
GLFW.glfwSetWindowShouldClose(Engine.getWindow(), true);
|
||||
}
|
||||
public static void parse() throws FileNotFoundException {
|
||||
|
||||
@ -276,18 +288,20 @@ public class match {
|
||||
case 11:
|
||||
endRound();
|
||||
if(roundsWonP1 >= 2 || roundsWonP2 >= 2) { endMatch();} //TODO : will probably need to specify more
|
||||
else{acCode = 0;}
|
||||
acCode = 0;
|
||||
break;
|
||||
|
||||
//if p1 is at 0 health
|
||||
case 12:
|
||||
roundsWonP2++;
|
||||
roundP1 =false;
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
//if p2 is at 0 health
|
||||
case 13:
|
||||
roundsWonP1++;
|
||||
roundP1=true;
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user