summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b147cc)
raw | patch | inline | side by side (parent: 1b147cc)
author | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 18:22:59 +0000 (01:22 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 19:06:49 +0000 (02:06 +0700) |
core/src/ru/deadsoftware/cavedroid/game/GameInput.java | patch | blob | history | |
core/src/ru/deadsoftware/cavedroid/game/mobs/Player.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 015d81a1ad6b2ff4abcea74462113214747d95f3..27c4df02e9b4a9ec9e5b05c8850867ef52e6e00f 100644 (file)
}
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()) {
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);
}
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();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java
index 34232f705e7e3fdf4303b6db6ecd16488de2c061..49c59ee2e8eaae923627e7b81367d63e84778dcb 100644 (file)
if (hitAnim < 30f || hitAnim > 90f) {
if (hitting) {
+ hitAnim = MathUtils.clamp(hitAnim, 30f, 90f);
hitAnimDelta = -hitAnimDelta;
} else {
hitAnimDelta = ANIMATION_SPEED;