summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-29 10:25:53 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-29 10:25:53 +0100
commit1f39ed07f64bc37d4869bca07c33b899f307d966 (patch)
tree1bd856e57e624a0d7850fc0c59242aa0e7360280 /core/src
parentc58f5d8be319f7d767679ac737d61f3895c52e58 (diff)
downloadRustAndDust-1f39ed07f64bc37d4869bca07c33b899f307d966.zip
RustAndDust-1f39ed07f64bc37d4869bca07c33b899f307d966.tar.gz
HeadedPawn: aimAt does a body rotation if no turret
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/HeadedPawn.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
index faecd6d..a1234a7 100644
--- a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
@@ -89,10 +89,13 @@ public abstract class HeadedPawn extends Pawn
@Override
public void aimAt(float r)
{
- if (canAim()) {
- turretR = r;
- turret.setRotation(body.getRotation() + turretR);
+ if (canAim())
+ turret.setRotation(body.getRotation() + r);
+ else {
+ float d = (r - turretR);
+ body.setRotation(body.getRotation() + d);
}
+ turretR = r;
}
@Override