mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 09:59:45 +02:00
CollisionHandler Anpassung
This commit is contained in:
@@ -15,13 +15,14 @@ public class CollisionHandler {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean checkCollision(Player movingObject, char d) {
|
public static boolean checkCollision(Player movingObject, char d) {
|
||||||
// if (movingObject == (movingObjects.get(0))) {
|
if (movingObject == (movingObjects.get(0))) {
|
||||||
if (movingObject.equals(movingObjects.get(0))) {
|
// return normalCheck(movingObject, d);
|
||||||
enemyCollision(movingObject, d);
|
// if (movingObject.equals(movingObjects.get(0))) {
|
||||||
|
// enemyCollision(movingObject, d);
|
||||||
hardwareCollision(movingObject, d);
|
hardwareCollision(movingObject, d);
|
||||||
return normalCheck(movingObject, d);
|
return normalCheck(movingObject, d);
|
||||||
} else {
|
} else {
|
||||||
playerCollision(movingObject, d);
|
// playerCollision(movingObject, d);
|
||||||
return normalCheck(movingObject, d);
|
return normalCheck(movingObject, d);
|
||||||
}
|
}
|
||||||
// switch (d) {
|
// switch (d) {
|
||||||
@@ -50,14 +51,23 @@ public class CollisionHandler {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
private static void playerCollision(Player movingObject, char d) {
|
private static void playerCollision(Player movingObject, char d) {
|
||||||
if (movingObject.getGridLocation().x== movingObjects.get(0).getGridLocation().x && movingObject.getGridLocation().y == movingObjects.get(0).getGridLocation().y) {
|
// if (movingObject.getGridLocation().x== movingObjects.get(0).getGridLocation().x && movingObject.getGridLocation().y == movingObjects.get(0).getGridLocation().y) {
|
||||||
// System.exit(-1);
|
//// System.exit(-1);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
private static void enemyCollision(Player movingObject, char d ) {
|
private static void enemyCollision(Player movingObject, char d ) {
|
||||||
|
// for (int i=1; i<movingObjects.size();i++) {
|
||||||
|
// if (movingObject.getGridLocation().x== movingObjects.get(i).getGridLocation().x && movingObject.getGridLocation().y == movingObjects.get(i).getGridLocation().y) {
|
||||||
|
//// System.exit(-1);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
public static void tick() {
|
||||||
for (int i=1; i<movingObjects.size();i++) {
|
for (int i=1; i<movingObjects.size();i++) {
|
||||||
if (movingObject.getGridLocation().x== movingObjects.get(i).getGridLocation().x && movingObject.getGridLocation().y == movingObjects.get(i).getGridLocation().y) {
|
if (movingObjects.get(0).getGridLocation().x== movingObjects.get(i).getGridLocation().x && movingObjects.get(0).getGridLocation().y == movingObjects.get(i).getGridLocation().y) {
|
||||||
// System.exit(-1);
|
Logger.enableLogging();
|
||||||
|
Logger.write("COLLISION WITH ENEMY");
|
||||||
|
Logger.disableLogging();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user