X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGameInput.java;h=c0fc292329e7af3909ed7ea52a9d9c5d38ce1854;hb=01f293d956e7ad17163c67b8f2a2ebfd8f64ac6d;hp=3e72368c319ef927efe0492d639a38d86b5d35ba;hpb=4140ddda97930af75b0d50b821ed9eb6337273e2;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java index 3e72368..c0fc292 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java @@ -1,9 +1,11 @@ package ru.deadsoftware.cavecraft.game; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.utils.TimeUtils; -import ru.deadsoftware.cavecraft.*; +import ru.deadsoftware.cavecraft.game.mobs.Pig; +import ru.deadsoftware.cavecraft.misc.AppState; +import ru.deadsoftware.cavecraft.misc.Assets; +import ru.deadsoftware.cavecraft.CaveGame; public class GameInput { @@ -73,12 +75,17 @@ public class GameInput { break; case Input.Keys.E: - if (CaveGame.STATE == GameState.GAME_PLAY) CaveGame.STATE = GameState.GAME_CREATIVE_INV; - else CaveGame.STATE = GameState.GAME_PLAY; + if (CaveGame.STATE == AppState.GAME_PLAY) CaveGame.STATE = AppState.GAME_CREATIVE_INV; + else CaveGame.STATE = AppState.GAME_PLAY; break; - case Input.Keys.N: - CaveGame.STATE = GameState.RESTART; + case Input.Keys.G: + gameProc.mobs.add(new Pig(gameProc.cursorX*16, gameProc.cursorY*16)); + break; + + case Input.Keys.ESCAPE: case Input.Keys.BACK: + CaveGame.STATE = AppState.GOTO_MENU; + break; } } @@ -98,7 +105,7 @@ public class GameInput { } public void touchDown(int screenX, int screenY, int button) { - if (CaveGame.STATE == GameState.GAME_CREATIVE_INV && + if (CaveGame.STATE == AppState.GAME_CREATIVE_INV && screenX>gameProc.renderer.camera.viewportWidth/2-Assets.creativeInv.getRegionWidth()/2 && screenXgameProc.renderer.camera.viewportHeight/2-Assets.creativeInv.getRegionHeight()/2 && @@ -112,8 +119,8 @@ public class GameInput { } gameProc.player.inventory[0] = item; } - } else if (CaveGame.STATE == GameState.GAME_CREATIVE_INV) { - CaveGame.STATE = GameState.GAME_PLAY; + } else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) { + CaveGame.STATE = AppState.GAME_PLAY; } else { gameProc.touchDownX = screenX; gameProc.touchDownY = screenY;