From: fred-boy Date: Fri, 27 Sep 2019 13:18:40 +0000 (+0700) Subject: Add more GameWorld methods X-Git-Tag: alpha0.4~46 X-Git-Url: http://deadsoftware.ru/gitweb?p=cavedroid.git;a=commitdiff_plain;h=d575b0a559319f8c569ab0177e56c2388a37f270 Add more GameWorld methods --- 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);