From: fred-boy Date: Mon, 18 Feb 2019 19:58:07 +0000 (+0700) Subject: Add buckets X-Git-Tag: alpha0.4~67 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=0f0a00cc4c8b1d80006682491179c41a285ef846;p=cavedroid.git Add buckets --- diff --git a/android/assets/items.png b/android/assets/items.png index d4ca336..1da9653 100644 Binary files a/android/assets/items.png and b/android/assets/items.png differ diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java index 39b9dfa..6c511a4 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java @@ -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)); } diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java index 7364e59..aa11931 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java @@ -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; + } } } diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java index 762492f..1229fcb 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java @@ -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); diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java index 9066d4b..6eb0e60 100644 --- a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java +++ b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java @@ -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;