summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-04-07 10:21:59 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-04-07 10:21:59 +0200
commite8b7e90a105a5d16eaba16d4faec406a129e1638 (patch)
tree794c7555e8c4dfd563ff533c59a13f08f517d3de
parentea6ff735f300b16525ec3059cd5baed8bd4eb9c8 (diff)
downloadRustAndDust-e8b7e90a105a5d16eaba16d4faec406a129e1638.zip
RustAndDust-e8b7e90a105a5d16eaba16d4faec406a129e1638.tar.gz
PromoteAnimation: play sound at get(), adjust duration from 0.3 to 0.5
-rw-r--r--core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
index e054acb..6eb22f0 100644
--- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
+++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
@@ -15,7 +15,7 @@ public class PromoteAnimation implements Animation, Drawable
{
private static PromoteAnimation instance = new PromoteAnimation();
- private static final float DURATION = 0.3f;
+ private static final float DURATION = 0.5f;
private static final float MAX_SCALE = 2f;
private static Sound usSound;
@@ -29,7 +29,6 @@ public class PromoteAnimation implements Animation, Drawable
private float y;
private float scale;
private float step;
- private float volume;
private float elapsed;
public static void init(AtlasRegion r, Sound usSnd, Sound geSnd)
@@ -52,12 +51,11 @@ public class PromoteAnimation implements Animation, Drawable
x = (x - (region.getRegionWidth() / 2.0f));
y = (y - (region.getRegionHeight() / 2.0f));
- instance.volume = v;
instance.x0 = x;
instance.y0 = y;
instance.scale = 0f;
instance.elapsed = 0f;
- snd = (us ? usSound : geSound);
+ (us ? usSound : geSound).play(v);
return instance;
}
@@ -71,10 +69,8 @@ public class PromoteAnimation implements Animation, Drawable
public boolean animate(float delta)
{
elapsed += delta;
- if (elapsed >= DURATION) {
- snd.play(volume);
+ if (elapsed >= DURATION)
return true;
- }
float s = MAX_SCALE * (float) Math.sin(Math.PI / DURATION * elapsed);
scale = 1f + s;