diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-29 08:00:53 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-29 08:00:53 +0100 |
commit | 84ef768964c4bf457bdefb340202e29c8799ffa0 (patch) | |
tree | 5b8ea380d85caa26a2ba2b71554b489bb4fb167e /core/src/ch/asynk/rustanddust/engine | |
parent | b6144eafe7f9a6ba4a79c452d60bc63cb3eca0bf (diff) | |
download | RustAndDust-84ef768964c4bf457bdefb340202e29c8799ffa0.zip RustAndDust-84ef768964c4bf457bdefb340202e29c8799ffa0.tar.gz |
TankFireAnimation: start shoot animation closer to the chit
Diffstat (limited to 'core/src/ch/asynk/rustanddust/engine')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java index 6159c04..c6f6e30 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java @@ -13,6 +13,7 @@ import ch.asynk.rustanddust.engine.gfx.Animation; public class TankFireAnimation implements Disposable, Animation, Pool.Poolable { + private static final float HALF_WIDTH_P = 0.9f; private static final float SHOT_SCATTERING = 60f; private static final float TIME_SCATTERING = 0.6f; private static final float START_DELAY = 0.8f; @@ -83,8 +84,8 @@ public class TankFireAnimation implements Disposable, Animation, Pool.Poolable y1 += ((SHOT_SCATTERING * FireAnimation.random.nextFloat()) - (SHOT_SCATTERING / 2f)); double r = Math.atan2((y0 - y1), (x0 - x1)); - float xadj = (float) (Math.cos(r) * halfWidth); - float yadj = (float) (Math.sin(r) * halfWidth); + float xadj = (float) (Math.cos(r) * halfWidth * HALF_WIDTH_P); + float yadj = (float) (Math.sin(r) * halfWidth * HALF_WIDTH_P); x0 -= xadj; y0 -= yadj; |