diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-03 17:27:45 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-03 17:27:45 +0200 |
commit | ddbdc3cb8a81a83dddf789ae84461b620b4f109f (patch) | |
tree | 944ebbfb4bce8722705f27d089b138ede667c1ad /core/src/ch/asynk/tankontank | |
parent | fd4f171c54636226a43eaacdb2082ff603dd5a74 (diff) | |
download | RustAndDust-ddbdc3cb8a81a83dddf789ae84461b620b4f109f.zip RustAndDust-ddbdc3cb8a81a83dddf789ae84461b620b4f109f.tar.gz |
Pawn: add Vector2 getCenter()
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index b22c0ef..22da2ed 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -51,6 +51,13 @@ public abstract class Pawn implements Drawable, Disposable return moves.getFirst(); } + public Vector2 getCenter() + { + float x = (image.getX() + (image.getWidth() / 2f)); + float y = (image.getY() + (image.getHeight() / 2f)); + return new Vector2(x, y); + } + public Vector2 getPosAt(Vector2 center, Vector2 pos) { float x = (center.x - (image.getWidth() / 2f)); |