From e8b7e90a105a5d16eaba16d4faec406a129e1638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 7 Apr 2016 10:21:59 +0200 Subject: PromoteAnimation: play sound at get(), adjust duration from 0.3 to 0.5 --- .../rustanddust/engine/gfx/animations/PromoteAnimation.java | 10 +++------- 1 file 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; -- cgit v1.1-2-g2b99