diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-21 15:48:05 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-21 15:48:05 +0100 |
commit | 0b9d19d55c63156c8ac103c43d91ed6ba8a7167d (patch) | |
tree | a82875f2593081142cba5a5b5a0c08a740b0217f | |
parent | a52bcc814acef086b6a3bb00d1183e5a185af9ce (diff) | |
download | RustAndDust-0b9d19d55c63156c8ac103c43d91ed6ba8a7167d.zip RustAndDust-0b9d19d55c63156c8ac103c43d91ed6ba8a7167d.tar.gz |
MoveToAnimation: callbacks float x y are center position
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java index 3e15261..ac09367 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java @@ -92,7 +92,7 @@ public class MoveToAnimation extends TimedAnimation protected void end() { if (cb != null) - cb.moveToAnimationDone(moveable, toX, toY, toR); + cb.moveToAnimationDone(moveable, (toX + (moveable.getWidth() / 2)), (toY + (moveable.getHeight() / 2)), toR); dispose(); } @@ -100,8 +100,10 @@ public class MoveToAnimation extends TimedAnimation protected void update(float percent) { if ((cb != null) && !notified && (percent >= 0.5)) { - cb.moveToAnimationLeave(moveable, fromX, fromY, fromR); - cb.moveToAnimationEnter(moveable, toX, toY, toR); + float dw = (moveable.getWidth() / 2); + float dh = (moveable.getHeight() / 2); + cb.moveToAnimationLeave(moveable, (fromX + dw), (fromY + dh), fromR); + cb.moveToAnimationEnter(moveable, (toX + dw), (toY + dh), toR); notified = true; } if (percent == 1f) |