summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-04 15:43:57 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-04 15:43:57 +0200
commit5d194a6751b56e40df0b9ef3f9c24e12fbda2920 (patch)
treeb445adfff2b582fabd60a42ac82be184ef3c255c /core/src/ch/asynk
parent0cada9e6834eb7013546a0a738940007712b646e (diff)
downloadRustAndDust-5d194a6751b56e40df0b9ef3f9c24e12fbda2920.zip
RustAndDust-5d194a6751b56e40df0b9ef3f9c24e12fbda2920.tar.gz
HeadedPawn: override getOrientation() setPosition(f,f[,f]), setRotation(f)
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/HeadedPawn.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
index 4f3a350..6ed498e 100644
--- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
@@ -35,17 +35,35 @@ public abstract class HeadedPawn extends Pawn
}
@Override
- public void setPosition(float x, float y, float z)
+ public Orientation getOrientation()
+ {
+ return orientation;
+ }
+
+ @Override
+ public void setPosition(float x, float y)
{
super.setPosition(x, y);
float cx = x + (getWidth() / 2f);
float cy = y + (getHeight() / 2f);
head.centerOn(cx, cy);
+ }
+
+ @Override
+ public void setRotation(float z)
+ {
head.setRotation(z);
this.orientation = Orientation.fromRotation(z);
}
@Override
+ public void setPosition(float x, float y, float z)
+ {
+ setPosition(x, y);
+ setRotation(z);
+ }
+
+ @Override
public void draw(Batch batch)
{
head.draw(batch);