diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 13 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Tile.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 3115c40..dc6ce63 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -181,6 +181,19 @@ public abstract class Board extends Image implements Disposable debugShapes.setTransformMatrix(prevTransform); } + public void clearOverlaysOn(int col, int row) + { + clearOverlaysOn(board[row][col]); + } + + public void clearOverlaysOn(Tile tile) + { + if (tile.clearOverlays()) + tilesToDraw.add(tile); + else + tilesToDraw.remove(tile); + } + public void enableOverlayOn(int col, int row, int i, boolean enable) { enableOverlayOn(board[row][col], i, enable); diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java index 92b8dc4..d517b27 100644 --- a/core/src/ch/asynk/tankontank/engine/Tile.java +++ b/core/src/ch/asynk/tankontank/engine/Tile.java @@ -52,6 +52,12 @@ public abstract class Tile implements BasicDrawable return (stack.size() != 0); } + public boolean clearOverlays() + { + overlays.clear(); + return occupied(); + } + public boolean hasOverlayEnabled() { return overlays.isEnabled(); diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java index 5eb5e55..70d30b8 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java @@ -17,6 +17,12 @@ public class StackedImages implements BasicDrawable this.enabled = new boolean[sprites.size]; } + public void clear() + { + for (int i = 0; i < sprites.size; i++) + enabled[i] = false; + } + public void enable(int i, boolean enable) { enabled[i] = enable; |