DEADSOFTWARE

Fix hitting animation
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameInput.java
index 015d81a1ad6b2ff4abcea74462113214747d95f3..27c4df02e9b4a9ec9e5b05c8850867ef52e6e00f 100644 (file)
@@ -193,6 +193,7 @@ public class GameInput {
     }
 
     private void useItem(int x, int y, int id, boolean bg) {
+        mPlayer.startHitting();
         String key = getItem(id).isBlock() ? getBlockKey(id) : getItemKey(id);
         if (id > 0) {
             if (getItem(id).isBlock()) {
@@ -322,6 +323,10 @@ public class GameInput {
                 mGameWorld.placeToForeground(mCurX, mCurY, 8);
                 break;
 
+            case Input.Keys.GRAVE:
+                mMobsController.getPlayer().gameMode = (mMobsController.getPlayer().gameMode + 1) % 2;
+                break;
+
             case Input.Keys.ESCAPE:
             case Input.Keys.BACK:
                 GameSaver.save(mMainConfig, mDropController, mMobsController, mGameWorld);
@@ -487,11 +492,15 @@ public class GameInput {
     }
 
     void update() {
-        if (mTouchedDown && mTouchDownBtn == Input.Buttons.LEFT) {
-            pressLMB();
-        } else {
+        if (!mTouchedDown) {
             mPlayer.stopHitting();
+            return;
         }
+
+        if (mTouchDownBtn == Input.Buttons.LEFT) {
+            pressLMB();
+        }
+
         if (mTouchedDown && TimeUtils.timeSinceMillis(mTouchDownTime) > 500) {
             holdMB();
         }