summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed11894)
raw | patch | inline | side by side (parent: ed11894)
author | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 12:20:00 +0000 (19:20 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 12:20:00 +0000 (19:20 +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 291311a68077622850ed90b533622ccf30ab6557..a0c5f664cdcef8d05081b11dee9488e502eb263e 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
+import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.TimeUtils;
import com.google.common.collect.Range;
}
}
+ private void hitMobs() {
+ final Player player = mMobsController.getPlayer();
+ mMobsController.forEach((mob) -> {
+ if (Intersector.overlaps(mob, player)) {
+ mob.damage(5);
+ mob.jump();
+ }
+ });
+ }
+
private void pressLMB() {
if (mMainConfig.checkGameUiWindow(GameUiWindow.NONE)) {
mPlayer.startHitting();
mTouchedDown = false;
}
} else {
+ hitMobs();
mTouchedDown = false;
}
}