diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Player.java | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index 0194cc7..12c9c13 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -20,21 +20,21 @@ public class Player implements Drawable, Disposable private static Random rand = new Random(); - private Army army; - private Image flag; - private ArrayList<Pawn> units; - private ArrayList<Pawn> casualties; - private ArrayList<Pawn> reinforcement; - private int actionPoints; + public Army army; + public Image flag; + public ArrayList<Pawn> units; + public ArrayList<Pawn> casualties; + public ArrayList<Pawn> reinforcement; + public int actionPoints; public Player(Army army, TextureAtlas atlas, String name, int size) { this.army = army; + this.actionPoints = 0; this.flag = new Image(atlas.findRegion(name)); this.units = new ArrayList<Pawn>(size); this.casualties = new ArrayList<Pawn>(size); this.reinforcement = new ArrayList<Pawn>(size); - this.actionPoints = 0; } public String toString() @@ -61,11 +61,6 @@ public class Player implements Drawable, Disposable System.err.println(" casualty : " + pawn); } - public Image getFlag() - { - return flag; - } - public boolean apExhausted() { return (actionPoints <= 0); @@ -87,7 +82,7 @@ public class Player implements Drawable, Disposable { for (Pawn pawn : units) pawn.reset(); - setActionPoints(); + computeActionPoints(); System.err.println("TurnStart " + toString()); } @@ -96,7 +91,7 @@ public class Player implements Drawable, Disposable return rand.nextInt(6) + 1; } - private void setActionPoints() + private void computeActionPoints() { this.actionPoints = 2; if (d6() > 2) { @@ -133,11 +128,36 @@ public class Player implements Drawable, Disposable return null; } + public boolean contains(float x, float y) + { + return flag.contains(x, y); + } + public void setPosition(float x, float y) { flag.setPosition(x, y); } + public float getX() + { + return flag.getX(); + } + + public float getY() + { + return flag.getY(); + } + + public float getWidth() + { + return flag.getWidth(); + } + + public float getHeight() + { + return flag.getHeight(); + } + public Iterator<Pawn> unitIterator() { return units.iterator(); |