X-Git-Url: http://deadsoftware.ru/gitweb?p=cavedroid.git;a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGameProc.java;h=45c62b82beaac999e403bf7fe6ab41ee2407187d;hp=49fe7056faf70015c50f5828e724c7374052491b;hb=7370b011158c7f9a1216dbf76de5acd9d277b7e9;hpb=7f1f702250f9cd05c1d7f5492e09ba16a56270ae diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index 49fe705..45c62b8 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -59,7 +59,7 @@ public class GameProc implements Serializable{ renderer = new GameRenderer(this,480, 480*((float)GameScreen.getHeight()/GameScreen.getWidth())); } - maxCreativeScroll = Items.BLOCKS.size/8; + maxCreativeScroll = Items.ITEMS.size()/8; GameSaver.save(this); } @@ -373,6 +373,13 @@ public class GameProc implements Serializable{ } } + public void useItem(int x, int y, int id, boolean bg) { + if (Items.ITEMS.get(id).getType()==0) { + if (!bg) world.placeToForeground(x, y, Items.ITEMS.get(id).getBlock()); + else world.placeToBackground(x, y, Items.ITEMS.get(id).getBlock()); + } + } + public void update(float delta) { RUN_TIME += delta; @@ -406,8 +413,7 @@ public class GameProc implements Serializable{ if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) { if (touchDownButton== Input.Buttons.RIGHT) { - world.placeToBackground(cursorX, cursorY, - player.inventory[invSlot]); + useItem(cursorX, cursorY, player.inventory[invSlot], true); } else if (touchDownY< Assets.invBar.getRegionHeight() && touchDownX>renderer.camera.viewportWidth/2-Assets.invBar.getRegionWidth()/2 && touchDownX