little text when a player win a round

+ at the begining of the second round players are in the right places
This commit is contained in:
Léo 2021-06-23 18:38:14 +02:00
parent ff7aafc94b
commit a0a5b015f1

View File

@ -81,9 +81,10 @@ public class match {
private static UIElementText timerUI; private static UIElementText timerUI;
private static UIElementText fpsCounter; private static UIElementText fpsCounter;
private static UIInputList inputListP1; private static UIInputList inputListP1;
private static UIElementText roundWon;
// Debug // Debug
public static boolean showP1Hitbox = false; public static boolean showP1Hitbox = false; // TODO modifier pour le rendre activable
public static boolean showP2Hitbox = false; public static boolean showP2Hitbox = false;
private static List<Hitbox> listHitboxObj = new ArrayList<>(); private static List<Hitbox> listHitboxObj = new ArrayList<>();
private static float slowFactor = 1f; private static float slowFactor = 1f;
@ -128,14 +129,43 @@ public class match {
* Ends the round. * Ends the round.
* Used for playing animations and such. * Used for playing animations and such.
* TODO : Implement this once we know what to do. * TODO : Implement this once we know what to do.
* @throws InterruptedException
*/ */
private static void endRound() { private static void endRound() throws InterruptedException {
if(roundP1) { if(roundP1) {
//texte de victoire
System.out.println("P1 won the round"); System.out.println("P1 won the round");
roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine);
roundWon.setBackground(new Vector3f(0f,0f,0f));
engine.add_uiElement(roundWon);
engine.update();
engine.render();
Thread.sleep(1000);
engine.remove_uiElement(roundWon);
//replacement des sprites
objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY()));
objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY()));
objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0));
objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0));
} }
else { else {
//texte de victoire
System.out.println("P2 won the round"); System.out.println("P2 won the round");
roundWon = new UIElementText("Player2 won the round", 5f, 0.25f, 0.5f, 100f, engine);
roundWon.setBackground(new Vector3f(0f,0f,0f));
engine.add_uiElement(roundWon);
engine.update();
engine.render();
Thread.sleep(1000);
engine.remove_uiElement(roundWon);
//replacement des sprites
objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY()));
objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY()));
objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0));
objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0));
} }
} }
@ -298,7 +328,7 @@ public class match {
} }
private static void ac(int i) { private static void ac(int i) throws InterruptedException {
// System.out.println(i); // System.out.println(i);
switch (i) { switch (i) {