summaryrefslogtreecommitdiffstats
path: root/src/se
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-11 12:02:22 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-11 12:02:22 +0100
commit56b2346e5c68f6ed4c112abce46eb1cbb614de2c (patch)
treef0e9cbd78028c7a3a51b57bed983d38c2b7a83fa /src/se
parent227e69ac212639f7a08fcfeb33d965bdcce0af50 (diff)
downloadtdde30-56b2346e5c68f6ed4c112abce46eb1cbb614de2c.tar.gz
code analysis
Diffstat (limited to 'src/se')
-rw-r--r--src/se/liu/gusso230/tetris/Board.java8
-rw-r--r--src/se/liu/gusso230/tetris/Poly.java2
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");
}