diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine/HeadedPawn.java')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/HeadedPawn.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java index d237e88..7da5b8b 100644 --- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java +++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java @@ -1,23 +1,22 @@ package ch.asynk.tankontank.engine; import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -import ch.asynk.tankontank.engine.gfx.Image; - import com.badlogic.gdx.math.Vector3; public abstract class HeadedPawn extends Pawn { - private Image head; + private Sprite head; protected Orientation orientation; public HeadedPawn(Faction faction, String pawn, String head, TextureAtlas pawns, TextureAtlas overlays) { super(faction, pawn, pawns, overlays); - this.head = new Image(pawns.findRegion(head)); + this.head = new Sprite(pawns.findRegion(head)); this.orientation = Orientation.KEEP; this.descr += " " + orientation; } @@ -26,7 +25,6 @@ public abstract class HeadedPawn extends Pawn public void dispose() { super.dispose(); - head.dispose(); } @Override @@ -54,7 +52,7 @@ public abstract class HeadedPawn extends Pawn super.setPosition(x, y); float cx = x + (getWidth() / 2f); float cy = y + (getHeight() / 2f); - head.centerOn(cx, cy); + head.setPosition((cx - (head.getWidth() / 2f)), (cy - (head.getHeight() / 2f))); } @Override @@ -82,7 +80,9 @@ public abstract class HeadedPawn extends Pawn @Override public void drawDebug(ShapeRenderer debugShapes) { - head.drawDebug(debugShapes); + float w = head.getWidth(); + float h = head.getHeight(); + debugShapes.rect(head.getX(), head.getY(), (w / 2f), (h / 2f), w, h, head.getScaleX(), head.getScaleY(), head.getRotation()); super.drawDebug(debugShapes); } } |