summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/animations
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-11-19 22:05:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2018-11-19 22:05:03 +0100
commit6a286977f2d696a381670f924f69fdc5589fade2 (patch)
tree017ed86a4acc4513acd2ddda1f584a82dfcb0efa /core/src/ch/asynk/gdx/boardgame/animations
parentb1c789062d5eb907727736851b943255d78dd1a3 (diff)
downloadgdx-boardgame-6a286977f2d696a381670f924f69fdc5589fade2.zip
gdx-boardgame-6a286977f2d696a381670f924f69fdc5589fade2.tar.gz
TimedAnimation : add comments about usage of begin()
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/animations')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java
index 04b84fd..5a22c2b 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java
@@ -6,6 +6,9 @@ public abstract class TimedAnimation implements Animation
protected float percent;
protected float elapsed;
+ // begin() may be called after the first call to draw()
+ // only use it to capture variables when the animation starts
+ // not to setup the Animation, do that it the Animation initialisation
abstract protected void begin();
abstract protected void end();
abstract protected void update(float delta);
@@ -28,7 +31,7 @@ public abstract class TimedAnimation implements Animation
@Override public boolean animate(float delta)
{
- if (percent == 0) {
+ if (elapsed == 0f) {
begin();
}