diff options
Diffstat (limited to 'core/src')
3 files changed, 8 insertions, 5 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java index cd4f3aa..cda604c 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java @@ -72,7 +72,7 @@ public class BounceAnimation extends TimedAnimation implements Pool.Poolable } } - @Override protected void update(float percent) + @Override protected void update(float elapsed, float percent) { piece.setScale(this.startScale + this.bounceFactor * (float) Math.sin(percent * Math.PI)); if (rotationDegrees != 0f) { diff --git a/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java index 695a21a..4ce6097 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java @@ -43,7 +43,7 @@ public class DelayAnimation extends TimedAnimation implements Pool.Poolable @Override protected void begin() { } @Override protected void end() { } - @Override protected void update(float percent) { } + @Override protected void update(float elapsed, float percent) { } @Override public void draw(Batch batch) { diff --git a/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java index 3d35dd9..3f351d2 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java @@ -6,10 +6,11 @@ public abstract class TimedAnimation implements Animation { private float dp; private float percent; + private float elapsed; abstract protected void begin(); abstract protected void end(); - abstract protected void update(float percent); + abstract protected void update(float elapsed, float percent); public void setDuration(float duration) { @@ -19,6 +20,7 @@ public abstract class TimedAnimation implements Animation public void reset() { percent = 0f; + elapsed = 0f; } @Override public boolean completed() @@ -32,7 +34,8 @@ public abstract class TimedAnimation implements Animation begin(); } - percent += (dp * delta); + elapsed += delta; + percent = (dp * elapsed); if (percent >= 1f) { // percent = 1f; @@ -40,7 +43,7 @@ public abstract class TimedAnimation implements Animation end(); return true; } else { - update(percent); + update(elapsed, percent); return false; } } |