diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java
index 49fe7056faf70015c50f5828e724c7374052491b..45c62b82beaac999e403bf7fe6ab41ee2407187d 100644 (file)
renderer = new GameRenderer(this,480,
480*((float)GameScreen.getHeight()/GameScreen.getWidth()));
}
- maxCreativeScroll = Items.BLOCKS.size/8;
+ maxCreativeScroll = Items.ITEMS.size()/8;
GameSaver.save(this);
}
}
}
+ 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;
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<renderer.camera.viewportWidth/2+Assets.invBar.getRegionWidth()/2) {