diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-21 15:41:41 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-21 15:41:41 +0100 |
commit | a52bcc814acef086b6a3bb00d1183e5a185af9ce (patch) | |
tree | fafcc48988f628b988a81ea7c10e654114e76e3f | |
parent | 03cb6cd1d5b84ae6650fd4749705361d35914688 (diff) | |
download | RustAndDust-a52bcc814acef086b6a3bb00d1183e5a185af9ce.zip RustAndDust-a52bcc814acef086b6a3bb00d1183e5a185af9ce.tar.gz |
Pawn: Vector2 getCenter() -> float getCenterX() and float getCenterY()
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 11 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index ba4a2bd..531b337 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -224,11 +224,14 @@ public abstract class Pawn implements Moveable, Disposable setPosition(position.x, position.y, position.z); } - public Vector2 getCenter() + public float getCenterX() { - float x = (getX() + (getWidth() / 2f)); - float y = (getY() + (getHeight() / 2f)); - return new Vector2(x, y); + return (getX() + (getWidth() / 2f)); + } + + public float getCenterY() + { + return (getY() + (getHeight() / 2f)); } public Vector2 getPosAt(Tile tile, Vector2 pos) diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 9ea8685..cb594f7 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -314,11 +314,11 @@ public abstract class Map extends Board AnimationSequence seq = AnimationSequence.get(2); if (success) { - explosions.init(1, target.getCenter().x, target.getCenter().y); + explosions.init(1, target.getCenterX(), target.getCenterY()); seq.addAnimation(explosions); seq.addAnimation(notifyDoneAnimation(unit)); } else { - explosion.init(1, target.getCenter().x, target.getCenter().y); + explosion.init(1, target.getCenterX(), target.getCenterY()); seq.addAnimation(explosion); seq.addAnimation(RunnableAnimation.get(unit, new Runnable() { @Override |