diff --git a/game-service/src/main/java/org/libertybikes/game/core/MovingObstacle.java b/game-service/src/main/java/org/libertybikes/game/core/MovingObstacle.java index e4c00eb..472727d 100644 --- a/game-service/src/main/java/org/libertybikes/game/core/MovingObstacle.java +++ b/game-service/src/main/java/org/libertybikes/game/core/MovingObstacle.java @@ -1,12 +1,8 @@ -/** - * - */ package org.libertybikes.game.core; public class MovingObstacle extends Obstacle { - public int xDir, yDir, oldX, oldY, moveDelay, currentDelay = 0; - public boolean hasMoved = false; + private int xDir, yDir, moveDelay, currentDelay = 0; public MovingObstacle(int w, int h, int x, int y) { super(w, h, x, y); @@ -62,14 +58,10 @@ public class MovingObstacle extends Obstacle { if (++currentDelay < moveDelay) { // don't move yet - hasMoved = false; return; } - hasMoved = true; currentDelay = 0; - oldX = x; - oldY = y; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { diff --git a/game-service/src/test/java/org/libertybikes/game/core/JsonDataTest.java b/game-service/src/test/java/org/libertybikes/game/core/JsonDataTest.java index 2cce74e..4349e9d 100644 --- a/game-service/src/test/java/org/libertybikes/game/core/JsonDataTest.java +++ b/game-service/src/test/java/org/libertybikes/game/core/JsonDataTest.java @@ -1,6 +1,3 @@ -/** - * - */ package org.libertybikes.game.core; import static org.junit.Assert.assertEquals; @@ -74,7 +71,7 @@ public class JsonDataTest { jsonb.toJson(board)); board.addObstacle(new MovingObstacle(11, 12, 13, 14, -1, 2, 50)); - assertEquals("{\"movingObstacles\":[{\"height\":12,\"width\":11,\"x\":13,\"y\":14,\"currentDelay\":0,\"hasMoved\":false,\"moveDelay\":50,\"oldX\":0,\"oldY\":0,\"xDir\":-1,\"yDir\":2}],\"obstacles\":[" + assertEquals("{\"movingObstacles\":[{\"height\":12,\"width\":11,\"x\":13,\"y\":14}],\"obstacles\":[" + obstacleJson + "],\"players\":[" + bobJson + "]}", jsonb.toJson(board)); }