DEADSOFTWARE

Add buckets
authorfred-boy <fred-boy@protonmail.com>
Mon, 18 Feb 2019 19:58:07 +0000 (02:58 +0700)
committerfred-boy <fredboy@protonmail.com>
Sun, 29 Sep 2019 04:38:50 +0000 (11:38 +0700)
android/assets/items.png
core/src/ru/deadsoftware/cavedroid/game/GameItems.java
core/src/ru/deadsoftware/cavedroid/game/GameProc.java
core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
core/src/ru/deadsoftware/cavedroid/misc/Assets.java

index d4ca336da12bf638f97aee84ed09210ef7adac54..1da9653133e094f5ceb5385c224acc1b03b364e3 100644 (file)
Binary files a/android/assets/items.png and b/android/assets/items.png differ
index 39b9dfacff283c046f2ac41cb4637f2641c8370c..6c511a4fb260de21abe7dd196226005b1f14ea3f 100644 (file)
@@ -176,6 +176,12 @@ public class GameItems {
         items.add(new Item("Diamond Shovel", 8, 1));
         //63
         items.add(new Item("Golden Shovel", 9, 1));
+        //64
+        items.add(new Item("Empty Bucket", 10, 2));
+        //65
+        items.add(new Item("Water Bucket", 11, 2));
+        //66
+        items.add(new Item("Lava Bucket", 12, 2));
 
     }
 
index 7364e5967c767fcb3cc9be56d27400080c95a7a5..aa11931410fd72428ff93927d73f2b834e1b24b6 100644 (file)
@@ -376,9 +376,25 @@ public class GameProc implements Serializable {
     }
 
     void useItem(int x, int y, int id, boolean bg) {
-        if (id > 0 && GameItems.getItem(id).getType() == 0) {
-            if (!bg) world.placeToForeground(x, y, GameItems.getItem(id).getBlock());
-            else world.placeToBackground(x, y, GameItems.getItem(id).getBlock());
+        if (id > 0) {
+            switch (GameItems.getItem(id).getType()) {
+                case 0:
+                    if (!bg) world.placeToForeground(x, y, GameItems.getItem(id).getBlock());
+                    else world.placeToBackground(x, y, GameItems.getItem(id).getBlock());
+                    break;
+                case 2:
+                    switch (id) {
+                        case 65:
+                            world.placeToForeground(x, y, 8);
+                            player.inv[player.invSlot] = 64;
+                            break;
+                        case 66:
+                            world.placeToForeground(x, y, 9);
+                            player.inv[player.invSlot] = 64;
+                            break;
+                    }
+                    break;
+            }
         }
     }
 
index 762492f4282d1bad8158f8fa1bb2395bec196ca8..1229fcb1e04ad68973c76726774598fc553e1313 100644 (file)
@@ -135,6 +135,7 @@ public class GameRenderer extends Renderer {
                                 y + 18 + ((i - GP.creativeScroll * 8) / 8) * 18);
                         break;
                     case 1:
+                    case 2:
                         spriter.draw(Assets.itemTex[GameItems.getItem(i).getTex()],
                                 x + 8 + ((i - GP.creativeScroll * 8) % 8) * 18,
                                 y + 18 + ((i - GP.creativeScroll * 8) / 8) * 18);
@@ -149,6 +150,7 @@ public class GameRenderer extends Renderer {
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
                     case 1:
+                    case 2:
                         spriter.draw(Assets.itemTex[GameItems.getItem(GP.player.inv[i]).getTex()],
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
@@ -174,6 +176,7 @@ public class GameRenderer extends Renderer {
                                 3);
                         break;
                     case 1:
+                    case 2:
                         spriter.draw(Assets.itemTex[GameItems.getItem(GP.player.inv[i]).getTex()],
                                 getWidth() / 2 - (float) Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
                                 3);
index 9066d4bfeede1ce9991eaf35791b2812a9e98bb9..6eb0e60dc03b64f55c91eb00cf1921506283f1ec 100644 (file)
@@ -11,7 +11,7 @@ import ru.deadsoftware.cavedroid.CaveGame;
 public class Assets {
 
     public static final int BLOCK_TEXTURES = 66;
-    public static final int ITEM_TEXTURES = 10;
+    public static final int ITEM_TEXTURES = 13;
 
     private static GlyphLayout layout;