DEADSOFTWARE

Start making survival mode
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameInput.java
index 5f7dfea6e2714ee3306ef5666585b5e6b9997642..687c6a9e5e6d919f96ab41b7dc0ee5ffbfd1bd06 100644 (file)
@@ -17,8 +17,8 @@ public class GameInput {
     }
 
     private boolean checkSwim() {
-        return (GameItems.isFluid(gp.world.getForeMap((int) (gp.player.position.x + gp.player.width / 2) / 16,
-                (int) (gp.player.position.y + gp.player.height / 4 * 3) / 16)));
+        return (GameItems.isFluid(gp.world.getForeMap((int) (gp.player.pos.x + gp.player.width / 2) / 16,
+                (int) (gp.player.pos.y + gp.player.height / 4 * 3) / 16)));
     }
 
     private void wasdPressed(int keycode) {
@@ -73,10 +73,10 @@ public class GameInput {
                     gp.swim = true;
                 } else if (gp.player.canJump) {
                     gp.player.move.add(0, -7);
-                } else if (!gp.player.flyMode) {
+                } else if (!gp.player.flyMode && gp.player.gameMode == 1) {
                     gp.player.flyMode = true;
                     gp.player.move.y = 0;
-                } else {
+                } else if (gp.player.flyMode) {
                     gp.player.move.y = -GamePhysics.PL_SPEED;
                 }
                 break;
@@ -86,7 +86,14 @@ public class GameInput {
                 break;
 
             case Input.Keys.E:
-                if (CaveGame.STATE == AppState.GAME_PLAY) CaveGame.STATE = AppState.GAME_CREATIVE_INV;
+                if (CaveGame.STATE == AppState.GAME_PLAY) switch (gp.player.gameMode) {
+                    case 0:
+                        //TODO survival inv
+                        break;
+                    case 1:
+                        CaveGame.STATE = AppState.GAME_CREATIVE_INV;
+                        break;
+                }
                 else CaveGame.STATE = AppState.GAME_PLAY;
                 break;