summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cab1b78)
raw | patch | inline | side by side (parent: cab1b78)
author | fred-boy <fredboy@protonmail.com> | |
Fri, 27 Sep 2019 19:17:25 +0000 (02:17 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Sun, 29 Sep 2019 04:39:18 +0000 (11:39 +0700) |
core/src/ru/deadsoftware/cavedroid/game/GameProc.java | patch | blob | history | |
core/src/ru/deadsoftware/cavedroid/misc/InputHandlerGame.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java
index b3b0d3f51a186197c5fb5c1b26185f1388b7984e..4de979050583c688ef682ed3205ac2655bfcb3e0 100644 (file)
int pastY = curY;
if (controlMode == ControlMode.WALK && CaveGame.TOUCH) {
- curX = player.getMapX();
- curY = (int) (player.pos.y + player.getWidth() / 16);
- while (curY - pastY < 2 && isNotAutoselectable(curX, curY)) {
+ curX = player.getMapX() + (player.looksLeft() ? -1 : 1);
+ curY = player.getUpperMapY();
+ for (int i = 0; i < 2 && isNotAutoselectable(curX, curY); i++) {
curY++;
}
- if (!isNotAutoselectable(curX, curY)) {
+ if (isNotAutoselectable(curX, curY)) {
curX += player.looksLeft() ? 1 : -1;
}
} else if (!CaveGame.TOUCH) {
}
private void holdMB() {
- if (touchDownBtn == Input.Buttons.RIGHT) {
- useItem(curX, curY, player.inventory[player.slot], true);
- isTouchDown = false;
- } else if (touchDownBtn == Input.Buttons.LEFT) {
- if (touchDownY < Assets.invBar.getRegionHeight() &&
- touchDownX > renderer.getWidth() / 2 - (float) Assets.invBar.getRegionWidth() / 2 &&
- touchDownX < renderer.getWidth() / 2 + (float) Assets.invBar.getRegionWidth() / 2) {
- CaveGame.GAME_STATE= GameState.CREATIVE_INV;
+ switch (touchDownBtn) {
+ case Input.Buttons.RIGHT:
+ useItem(curX, curY, player.inventory[player.slot], true);
isTouchDown = false;
- }
+ break;
+ case Input.Buttons.LEFT:
+ break;
+ default:
+ if (touchDownY < Assets.invBar.getRegionHeight() &&
+ touchDownX > renderer.getWidth() / 2 - (float) Assets.invBar.getRegionWidth() / 2 &&
+ touchDownX < renderer.getWidth() / 2 + (float) Assets.invBar.getRegionWidth() / 2) {
+ CaveGame.GAME_STATE= GameState.CREATIVE_INV;
+ isTouchDown = false;
+ }
}
}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/InputHandlerGame.java b/core/src/ru/deadsoftware/cavedroid/misc/InputHandlerGame.java
index a84e22af7a72c1afae78fb199e9baa098fcfca60..c00521f1311570106c91e8aecc5d2b4a1458238e 100644 (file)
if (CaveGame.TOUCH) {
if (screenX > 26 && screenX < 52 && screenY > GP.renderer.getHeight() - 52 &&
screenY < GP.renderer.getHeight() - 26) {
- if (GP.controlMode == ControlMode.WALK) {
+ if (GP.controlMode == ControlMode.CURSOR) {
gameInput.keyDown(Input.Keys.W);
} else {
gameInput.keyDown(Input.Keys.SPACE);