diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-17 10:27:54 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-17 10:27:54 +0200 |
commit | 736eb7cc1c06ef0d406279e56615d7c0f24cbd24 (patch) | |
tree | 5ff2d57d08508725f10ec1a2d07ecdab62a031ef /core | |
parent | 4c84559a3a757324ea094dc753e51bf5ec189b28 (diff) | |
download | RustAndDust-736eb7cc1c06ef0d406279e56615d7c0f24cbd24.zip RustAndDust-736eb7cc1c06ef0d406279e56615d7c0f24cbd24.tar.gz |
Hud: use player instead of player.flag
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Ctrl.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 26 |
2 files changed, 6 insertions, 21 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 8c7a840..77fab1f 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -112,7 +112,6 @@ public class Ctrl implements Disposable { if (map.activatedPawnsCount() > 0) { player().burnDownOneAp(); - hud.update(); } if (player().apExhausted()) nextPlayer(); diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 2a84d0a..35c0726 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -24,8 +24,6 @@ public class Hud implements Disposable private final TankOnTank game; private final Ctrl ctrl; - private Image flag; - private Bg bg; public Button moveBtn; public Button rotateBtn; @@ -37,7 +35,6 @@ public class Hud implements Disposable private Button btn; private Msg msg; - private Rectangle infoRect; private Vector2 corner; public Hud(final Ctrl ctrl, final TankOnTank game) @@ -58,13 +55,8 @@ public class Hud implements Disposable bg = new Bg(atlas.findRegion("disabled")); msg = new Msg(game.skin.getFont("default-font"), atlas.findRegion("disabled")); - flag = ctrl.currentPlayer().getFlag(); - flag.setPosition(OFFSET, (Gdx.graphics.getHeight() - flag.getHeight() - OFFSET)); - // TODO add counters for - // - Action Points - // - Turn - - infoRect = new Rectangle(flag.getX(), flag.getY(), flag.getWidth(), flag.getHeight()); + ctrl.player().setTopLeft(Gdx.graphics.getHeight(), OFFSET); + ctrl.opponent().setTopLeft(Gdx.graphics.getHeight(), OFFSET); } @Override @@ -87,7 +79,7 @@ public class Hud implements Disposable public void draw(Batch batch) { - flag.draw(batch); + ctrl.player().draw(batch); bg.draw(batch); if (moveBtn.visible) moveBtn.getImage().draw(batch); if (rotateBtn.visible) rotateBtn.getImage().draw(batch); @@ -98,12 +90,6 @@ public class Hud implements Disposable msg.draw(batch); } - public void updatePlayer() - { - msg.write("Next Player", 1); - flag = ctrl.currentPlayer().getFlag(); - flag.setPosition(OFFSET, (Gdx.graphics.getHeight() - flag.getHeight() - OFFSET)); - } private float setButton(Button btn, float x, float y) { @@ -147,7 +133,7 @@ public class Hud implements Disposable public boolean touchDown(float x, float y) { - if (infoRect.contains(x,y)) return true; + if (ctrl.player().contains(x,y)) return true; if (!bg.contains(x,y)) return false; btn = null; @@ -176,8 +162,8 @@ public class Hud implements Disposable if (btn != null) btn.setOn(); - if (infoRect.contains(x,y)) { - ctrl.endTurn(); + if (ctrl.player().contains(x,y)) { + ctrl.endPlayerTurn(); return true; } if (!bg.contains(x,y)) return false; |