stageBoundary
Check on camera should be done too.
This commit is contained in:
parent
0a165de74b
commit
717daf3831
@ -79,6 +79,10 @@ public class match {
|
||||
private static UIInputList inputListP1;
|
||||
private static UIElementText matchWon;
|
||||
|
||||
// Stage attribute
|
||||
private static int leftBoundary;
|
||||
private static int rightBoundary;
|
||||
|
||||
// Debug
|
||||
public static boolean showP1Hitbox;
|
||||
public static boolean showP2Hitbox;
|
||||
@ -312,6 +316,9 @@ public class match {
|
||||
timeStampFpsCounter = System.currentTimeMillis();
|
||||
//SetTracking
|
||||
engine.setCameraTrackingSF3ThirdStrike(objP1, objP2);
|
||||
//Stage
|
||||
leftBoundary = (int) background.getXPos();
|
||||
rightBoundary = (int) (background.getXPos() + background.getWidth() * background.getScalingFactor());
|
||||
|
||||
while(frameCount < 5940 && engine.getRunning()) {
|
||||
ac(acCode);
|
||||
@ -415,10 +422,13 @@ public class match {
|
||||
updatePos(p1,p1LooksRight);
|
||||
updatePos(p2,!p1LooksRight);
|
||||
|
||||
stageBoundary();
|
||||
|
||||
pushBox();
|
||||
|
||||
cameraPushBack();
|
||||
|
||||
|
||||
if(p1LooksRight) {
|
||||
|
||||
f = p1.getCurrentframe();
|
||||
@ -815,6 +825,34 @@ public class match {
|
||||
}
|
||||
}
|
||||
|
||||
private static void stageBoundary(){
|
||||
// TODO arrêter de dupliquer du code
|
||||
boolean lookRight = p1.getPosX() < p2.getPosX();
|
||||
Character left;
|
||||
Character right;
|
||||
ObjectGl rightObj;
|
||||
if (lookRight) {
|
||||
left = p1;
|
||||
right = p2;
|
||||
rightObj = objP2;
|
||||
} else {
|
||||
left = p2;
|
||||
right = p1;
|
||||
rightObj = objP1;
|
||||
}
|
||||
|
||||
int leftBoundaryDist = leftBoundary - left.getPosX();
|
||||
if (leftBoundaryDist > 0){
|
||||
left.setPos(left.getPosX() + leftBoundaryDist, left.getPosY());
|
||||
}
|
||||
|
||||
int rightBoundaryDist = rightBoundary - (int) (right.getPosX() + rightObj.getWidth() * rightObj.getScalingFactor());
|
||||
if (rightBoundaryDist < 0){
|
||||
right.setPos(right.getPosX() + rightBoundaryDist, right.getPosY());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
HITBOX DEBUG METHOD
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user