summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfadf32)
raw | patch | inline | side by side (parent: cfadf32)
author | fred-boy <fredboy@protonmail.com> | |
Mon, 27 Apr 2020 03:57:28 +0000 (10:57 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Mon, 27 Apr 2020 03:57:28 +0000 (10:57 +0700) |
core/src/ru/deadsoftware/cavedroid/game/GameInput.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameInput.java b/core/src/ru/deadsoftware/cavedroid/game/GameInput.java
index bef9b558bb2471f848033ddd884f1834c4cdd9b0..dcc1615667226d96b352a3597160f1fdf4cc6def 100644 (file)
public class GameInput {
- private boolean keyDown, touchedDown;
+ private boolean keyDown, touchedDown, dragging;
private int keyDownCode, touchDownBtn;
private float touchDownX, touchDownY;
}
private void pressLMB() {
- if ((GP.world.hasForeAt(curX, curY) && GP.world.getForeMapBlock(curX, curY).getHp() >= 0) ||
+ if (CaveGame.GAME_STATE == GameState.PLAY &&
+ ((GP.world.hasForeAt(curX, curY) && GP.world.getForeMapBlock(curX, curY).getHp() >= 0) ||
(!GP.world.hasForeAt(curX, curY) && GP.world.hasBackAt(curX, curY) &&
- GP.world.getBackMapBlock(curX, curY).getHp() >= 0)) {
+ GP.world.getBackMapBlock(curX, curY).getHp() >= 0))) {
if (GP.player.gameMode == 0) {
blockDamage++;
if (GP.world.hasForeAt(curX, curY)) {
}
public void touchUp(float screenX, float screenY, int button) {
+ if (dragging) {
+ dragging = false;
+ return;
+ }
+
if (CaveGame.TOUCH && keyDown) {
keyUp(keyDownCode);
keyDown = false;
}
public void touchDragged(float screenX, float screenY) {
+ dragging = true;
if (CaveGame.GAME_STATE == GameState.CREATIVE_INV && Math.abs(screenY - touchDownY) > 16) {
if (insideCreativeInv(screenX, screenY)) {
creativeScroll -= (screenY - touchDownY) / 16;