Commit 2215d357 authored by 9831111's avatar 9831111 🙂

Check wall enter for key down.

parent 673d25eb
......@@ -106,7 +106,22 @@ public class GameState {
}
if (keyDOWN) {
PermissionDown=true;
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)
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