mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 10:19:46 +02:00
Collision Opponent angepasst
This commit is contained in:
@@ -107,29 +107,26 @@ public class Opponent extends Player {
|
|||||||
testY=this.getGridLocation().y + i;
|
testY=this.getGridLocation().y + i;
|
||||||
testX=this.getGridLocation().x;
|
testX=this.getGridLocation().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Umwandeln der numerischen Darstellung der Richtung und CollisionHandler verständlich Angabe
|
if ( d == 'x' && i == -1 ) {
|
||||||
// charDir = ( d == 'x' && i == -1 ) ? 'l' : 'r';
|
charDir = 'l';
|
||||||
// charDir = ( d == 'y' && i == -1 ) ? 'u' : 'd';
|
} else if ( d == 'x' && i == 1 ) {
|
||||||
// if (CollisionHandler.checkCollision(this, charDir)) {
|
charDir = 'r';
|
||||||
// System.out.println("Kollision!");
|
} else if ( d == 'y' && i == -1 ) {
|
||||||
// this.setGridLocation(testX, testY);
|
charDir = 'u';
|
||||||
// this.prevd = d;
|
} else if ( d == 'y' && i == 1 ) {
|
||||||
// this.previ = i;
|
charDir = 'd';
|
||||||
// redecide = false;
|
}
|
||||||
// animate = true;
|
|
||||||
// break;
|
if (CollisionHandler.checkCollision(this, charDir)) {
|
||||||
// }
|
System.out.println("Kollision!");
|
||||||
|
|
||||||
// Testen ob die gewählte Richtung begehbar ist
|
|
||||||
if (MapGrid.getGridCell(testX,testY).isPath()) {
|
|
||||||
this.setGridLocation(testX, testY);
|
this.setGridLocation(testX, testY);
|
||||||
this.prevd = d;
|
this.prevd = d;
|
||||||
this.previ = i;
|
this.previ = i;
|
||||||
redecide = false;
|
redecide = false;
|
||||||
animate = true;
|
animate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +156,7 @@ public class Opponent extends Player {
|
|||||||
}
|
}
|
||||||
if (stepCounter <= 0) {
|
if (stepCounter <= 0) {
|
||||||
stepCounter = 25;
|
stepCounter = 25;
|
||||||
|
|
||||||
if ( ! MapGrid.getGridCell(newx,newy).isPath()) {
|
if ( ! MapGrid.getGridCell(newx,newy).isPath()) {
|
||||||
redecide = true;
|
redecide = true;
|
||||||
animate = false;
|
animate = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user