diff options
| -rw-r--r-- | src/se/liu/gusso230/tetris/Board.java | 8 | ||||
| -rw-r--r-- | src/se/liu/gusso230/tetris/Poly.java | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/se/liu/gusso230/tetris/Board.java b/src/se/liu/gusso230/tetris/Board.java index c730958..da5606c 100644 --- a/src/se/liu/gusso230/tetris/Board.java +++ b/src/se/liu/gusso230/tetris/Board.java @@ -40,7 +40,7 @@ public class Board { System.out.println("tick"); if (state == GameState.RUNNING) { if (falling == null) { - newFalling(); + createFalling(); } else { moveFalling(); } @@ -49,7 +49,7 @@ public class Board { private void moveFalling() { fallingY += 1; - if (hasFallingCollision() || !falling.inside(fallingX, fallingY, 0, width - 1, 0, height - 1)) { + if (hasFallingCollision() || !falling.isInside(fallingX, fallingY, 0, width - 1, 0, height - 1)) { fallingY -= 1; placeAt(falling, fallingX, fallingY); falling = null; @@ -57,7 +57,7 @@ public class Board { notifyListeners(); } - private void newFalling() { + private void createFalling() { falling = tetrominoMaker.getRandomPoly(RND); fallingX = (width - falling.getBoundingBoxSize()) / 2; fallingY = -1; @@ -85,7 +85,7 @@ public class Board { break; } fallingX += dx; - if (!falling.inside(fallingX, fallingY, 0, width - 1, 0, height - 1) + if (!falling.isInside(fallingX, fallingY, 0, width - 1, 0, height - 1) || hasFallingCollision()) { fallingX -= dx; diff --git a/src/se/liu/gusso230/tetris/Poly.java b/src/se/liu/gusso230/tetris/Poly.java index 6f8bece..734b25e 100644 --- a/src/se/liu/gusso230/tetris/Poly.java +++ b/src/se/liu/gusso230/tetris/Poly.java @@ -53,7 +53,7 @@ public class Poly { * @param minY The y position of the "minimum" corner. * @param maxY The y position of the "maximum" corner. */ - public boolean inside(int posX, int posY, int minX, int maxX, int minY, int maxY) { + public boolean isInside(int posX, int posY, int minX, int maxX, int minY, int maxY) { if (minX > maxX) { throw new IllegalArgumentException("minX has to be smaller than or equal to maxX"); } |
