Commit 2215d357 authored by 9831111's avatar 9831111 🙂

Check wall enter for key down.

parent 673d25eb
...@@ -95,7 +95,7 @@ public class GameState { ...@@ -95,7 +95,7 @@ public class GameState {
if (wall.getWidth() == 50 && wall.getHeight() == 5 && rotateAmount != 180 && rotateAmount != -180 && rotateAmount != 0) { if (wall.getWidth() == 50 && wall.getHeight() == 5 && rotateAmount != 180 && rotateAmount != -180 && rotateAmount != 0) {
if ((getBounds(locX, locY).intersects(new Rectangle((int) wall.getX(), (int) wall.getY(), 50, 5)))) { if ((getBounds(locX, locY).intersects(new Rectangle((int) wall.getX(), (int) wall.getY(), 50, 5)))) {
PermissionUp = false; PermissionUp = false;
break; break;
} }
} }
...@@ -106,10 +106,25 @@ public class GameState { ...@@ -106,10 +106,25 @@ public class GameState {
} }
if (keyDOWN) { if (keyDOWN) {
PermissionDown=true;
for (Wall wall : Controller.walls) { for (Wall wall : Controller.walls) {
if (wall.getWidth() == 5 && wall.getHeight() == 50 && rotateAmount != 90 && rotateAmount != -90 && rotateAmount != 270 && rotateAmount != -270) {
if ((getBounds(locX, locY).intersects(new Rectangle((int) wall.getX(), (int) wall.getY(), 5, 50)))) {
PermissionDown = false;
break;
}
}
if (wall.getWidth() == 50 && wall.getHeight() == 5 && rotateAmount != 180 && rotateAmount != -180 && rotateAmount != 0) {
if ((getBounds(locX, locY).intersects(new Rectangle((int) wall.getX(), (int) wall.getY(), 50, 5)))) {
PermissionDown = false;
break;
}
}
} }
if (PermissionDown) if (PermissionDown)
move(-5); move(-5);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment