From d575b0a559319f8c569ab0177e56c2388a37f270 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Fri, 27 Sep 2019 20:18:40 +0700 Subject: [PATCH] Add more GameWorld methods --- core/src/ru/deadsoftware/cavedroid/game/GameWorld.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java index e9539e2..9c71cfc 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java @@ -60,10 +60,14 @@ public class GameWorld { } } - public boolean hasBlockAt(int x, int y) { + public boolean hasForeAt(int x, int y) { return getMap(x, y, 0) != 0; } + public boolean hasBackAt(int x, int y) { + return getMap(x, y, 1) != 0; + } + public int getForeMap(int x, int y) { return getMap(x, y, 0); } @@ -112,7 +116,7 @@ public class GameWorld { } public void placeToForeground(int x, int y, int value) { - if (!hasBlockAt(x, y) || value == 0 || !GameItems.getBlock(getForeMap(x, y)).hasCollision()) { + if (!hasForeAt(x, y) || value == 0 || !GameItems.getBlock(getForeMap(x, y)).hasCollision()) { setForeMap(x, y, value); } else if (GameItems.isSlab(value) && getForeMap(x, y) == value) { placeSlab(x, y, value); -- 2.29.2