From 6a286977f2d696a381670f924f69fdc5589fade2 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Mon, 19 Nov 2018 22:05:03 +0100 Subject: TimedAnimation : add comments about usage of begin() --- core/src/ch/asynk/gdx/boardgame/animations/TimedAnimation.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/src/ch/asynk') 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(); } -- cgit v1.2.3