CameraPushBack fonctionne 😎 (pour de vrai 🤞)
This commit is contained in:
parent
a5d142332f
commit
8a7d0e69b2
@ -32,7 +32,6 @@ import org.json.simple.JSONArray;
|
|||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import static org.lwjgl.glfw.GLFW.*;
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ 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;
|
private static UIElementText matchWon;
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
public static boolean showP1Hitbox;
|
public static boolean showP1Hitbox;
|
||||||
@ -132,9 +131,9 @@ public class match {
|
|||||||
String victoryTxt = roundP1 ? "Player1 won the round"+roundCounter : "Player2 won the round"+roundCounter;
|
String victoryTxt = roundP1 ? "Player1 won the round"+roundCounter : "Player2 won the round"+roundCounter;
|
||||||
|
|
||||||
System.out.println(victoryTxt);
|
System.out.println(victoryTxt);
|
||||||
roundWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 200f, engine);
|
matchWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 200f, engine);
|
||||||
roundWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
matchWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
||||||
engine.add_uiElement(roundWon);
|
engine.add_uiElement(matchWon);
|
||||||
|
|
||||||
timeStamp1 = System.currentTimeMillis();
|
timeStamp1 = System.currentTimeMillis();
|
||||||
while(System.currentTimeMillis() - timeStamp1 < 2500){
|
while(System.currentTimeMillis() - timeStamp1 < 2500){
|
||||||
@ -142,7 +141,7 @@ public class match {
|
|||||||
engine.render();
|
engine.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.remove_uiElement(roundWon);
|
engine.remove_uiElement(matchWon);
|
||||||
|
|
||||||
//replacement des sprites
|
//replacement des sprites
|
||||||
objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY()));
|
objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY()));
|
||||||
@ -158,9 +157,19 @@ public class match {
|
|||||||
* TODO : Implement this once we know what to do.
|
* TODO : Implement this once we know what to do.
|
||||||
*/
|
*/
|
||||||
private static void endMatch() {
|
private static void endMatch() {
|
||||||
if (roundsWonP1 > roundsWonP2 ) {System.out.println("P1 won the match");}
|
String victoryTxt = roundsWonP1 > roundsWonP2 ? "P1 won the match" : "P2 won the match";
|
||||||
else {System.out.println("P1 won the match");}
|
|
||||||
GLFW.glfwSetWindowShouldClose(Engine.getWindow(), true);
|
matchWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 200f, engine);
|
||||||
|
matchWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
||||||
|
engine.add_uiElement(matchWon);
|
||||||
|
|
||||||
|
timeStamp1 = System.currentTimeMillis();
|
||||||
|
while(System.currentTimeMillis() - timeStamp1 < 2500){
|
||||||
|
engine.update();
|
||||||
|
engine.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.setRunning(false);
|
||||||
}
|
}
|
||||||
public static void parse() throws FileNotFoundException {
|
public static void parse() throws FileNotFoundException {
|
||||||
|
|
||||||
@ -798,11 +807,9 @@ public class match {
|
|||||||
boolean rightOOB = right.getPosX() + rightObj.getWidth() * rightObj.getScalingFactor() > -engine.getViewXPos() + engine.getCamera().getDimension();
|
boolean rightOOB = right.getPosX() + rightObj.getWidth() * rightObj.getScalingFactor() > -engine.getViewXPos() + engine.getCamera().getDimension();
|
||||||
|
|
||||||
if(leftOOB && rightOutOfView - leftOutOfView > 0){
|
if(leftOOB && rightOutOfView - leftOutOfView > 0){
|
||||||
System.out.println("Left: " + leftOutOfView);
|
|
||||||
left.setPos((int) (left.getPosX() - leftOutOfView), left.getPosY());
|
left.setPos((int) (left.getPosX() - leftOutOfView), left.getPosY());
|
||||||
}
|
}
|
||||||
if(rightOOB && leftOutOfView + rightOutOfView < 0){
|
if(rightOOB && leftOutOfView - rightOutOfView < 0){
|
||||||
System.out.println("Right: " + rightOutOfView);
|
|
||||||
right.setPos((int) (right.getPosX() - rightOutOfView), right.getPosY());
|
right.setPos((int) (right.getPosX() - rightOutOfView), right.getPosY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user