DEADSOFTWARE

Add more GameWorld methods
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameWorld.java
index 89c458523c1a0c53df3f1f3cdf97138c5dbcc3b5..9c71cfc306a32ff9aa92dd3b8d318dd3096f9803 100644 (file)
@@ -27,11 +27,11 @@ public class GameWorld {
         return HEIGHT * 16f;
     }
 
-    public int[][] getFullForeMap() {
+    int[][] getFullForeMap() {
         return foreMap;
     }
 
-    public int[][] getFullBackMap() {
+    int[][] getFullBackMap() {
         return backMap;
     }
 
@@ -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);