summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-05 16:00:14 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-05 16:00:14 +0100
commitb5733bea1dd92375a040baed404d9e00a48c9d96 (patch)
tree2bb12c0e16bee1f0751891a911cbd63df9865fd3
parentbd8eb80cf2c58d249050d999391beb6f0d6e37ea (diff)
downloadRustAndDust-b5733bea1dd92375a040baed404d9e00a48c9d96.zip
RustAndDust-b5733bea1dd92375a040baed404d9e00a48c9d96.tar.gz
InfantryFireAnimation: improve animation
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/InfantryFireAnimation.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/InfantryFireAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/InfantryFireAnimation.java
index 11e5c68..81c8713 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/animations/InfantryFireAnimation.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/InfantryFireAnimation.java
@@ -109,13 +109,13 @@ public class InfantryFireAnimation implements Disposable, Animation, Pool.Poolab
}
}
- private static final int SHOT_COUNT = 20;
- private static final float SHOT_DELAY = 0.07f;
+ private static final int SHOT_COUNT = 19;
+ private static final float SHOT_DELAY = (1.6f / SHOT_COUNT);
private static final float SHOT_SCATTERING = 40f;
private static final float TIME_SCATTERING = 0.6f;
private static final float START_DELAY = 0.8f;
private static final float SHOT_SPEED = 1000f;
- private static final float HIT_FRAME_DURATION = 0.07f;
+ private static final float HIT_FRAME_DURATION = 0.05f;
private Shot[] shots;
@@ -161,10 +161,8 @@ public class InfantryFireAnimation implements Disposable, Animation, Pool.Poolab
float w = (float) Math.sqrt((dx * dx) + (dy * dy));
double dr = (Math.atan2(halfWidth, w) / 2f);
- int half = (SHOT_COUNT / 2);
- double a = (r + dr);
- double aMax = (a - (2 * dr));
- double da = ((2 * dr) / half);
+ double a = (r + (dr / 2f));
+ double da = (dr / (float) SHOT_COUNT);
for (Shot shot : shots) {
float x = (float) (x0 - (Math.cos(a) * w));
@@ -173,9 +171,7 @@ public class InfantryFireAnimation implements Disposable, Animation, Pool.Poolab
shot.set(delay, x0, y0, x, y, w, (float) Math.toDegrees(a));
delay += SHOT_DELAY;
- a -= da;
- if (a <= aMax)
- da = -da;
+ a -= 2 * (da * FireAnimation.random.nextFloat());
}
}