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