diff options
-rw-r--r-- | android/assets/data/hud.atlas | 36 | ||||
-rw-r--r-- | android/assets/data/hud.png | bin | 65949 -> 66514 bytes | |||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Engagement.java | 42 | ||||
-rw-r--r-- | data/assets/hud/attack.png | bin | 0 -> 390 bytes | |||
-rw-r--r-- | data/assets/hud/defense.png | bin | 0 -> 271 bytes |
5 files changed, 44 insertions, 34 deletions
diff --git a/android/assets/data/hud.atlas b/android/assets/data/hud.atlas index cec4298..c5d5f87 100644 --- a/android/assets/data/hud.atlas +++ b/android/assets/data/hud.atlas @@ -5,77 +5,91 @@ filter: Nearest,Nearest repeat: none aps rotate: false - xy: 2, 19 + xy: 2, 28 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 +attack + rotate: false + xy: 68, 2 + size: 24, 24 + orig: 24, 24 + offset: 0, 0 + index: -1 cancel rotate: false - xy: 130, 147 + xy: 130, 156 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 +defense + rotate: false + xy: 94, 2 + size: 24, 24 + orig: 24, 24 + offset: 0, 0 + index: -1 disabled rotate: false - xy: 84, 69 + xy: 84, 78 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 ge-flag rotate: false - xy: 2, 69 + xy: 2, 78 size: 80, 48 orig: 80, 48 offset: 0, 0 index: -1 ok rotate: false - xy: 52, 19 + xy: 52, 28 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 promote rotate: false - xy: 180, 147 + xy: 180, 156 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 reinforcement rotate: false - xy: 102, 19 + xy: 102, 28 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 reinforcement-selected rotate: false - xy: 2, 119 + xy: 2, 128 size: 126, 126 orig: 126, 126 offset: 0, 0 index: -1 stars rotate: false - xy: 2, 2 + xy: 2, 11 size: 64, 15 orig: 64, 15 offset: 0, 0 index: -1 turns rotate: false - xy: 134, 97 + xy: 134, 106 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 us-flag rotate: false - xy: 130, 197 + xy: 130, 206 size: 80, 48 orig: 80, 48 offset: 0, 0 diff --git a/android/assets/data/hud.png b/android/assets/data/hud.png Binary files differindex 4d10b46..d4429e0 100644 --- a/android/assets/data/hud.png +++ b/android/assets/data/hud.png diff --git a/core/src/ch/asynk/tankontank/game/hud/Engagement.java b/core/src/ch/asynk/tankontank/game/hud/Engagement.java index a5d10cf..d9a9ff1 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Engagement.java +++ b/core/src/ch/asynk/tankontank/game/hud/Engagement.java @@ -18,9 +18,9 @@ public class Engagement extends Bg implements Animation public float padding; private Sprite usFlag; private Sprite geFlag; - private Sprite geWinner; - private Sprite usWinner; private Sprite winner; + private Sprite attackImg; + private Sprite defenseImg; private Label attack; private Label defense; private Label attackR; @@ -34,10 +34,8 @@ public class Engagement extends Bg implements Animation super(region); usFlag = new Sprite(atlas.findRegion("us-flag")); geFlag = new Sprite(atlas.findRegion("ge-flag")); - usWinner = new Sprite(usFlag); - geWinner = new Sprite(geFlag); - usFlag.setSize(usFlag.getWidth() * (FLAG_HEIGHT / usFlag.getHeight()), FLAG_HEIGHT); - geFlag.setSize(geFlag.getWidth() * (FLAG_HEIGHT / geFlag.getHeight()), FLAG_HEIGHT); + attackImg = new Sprite(atlas.findRegion("attack")); + defenseImg = new Sprite(atlas.findRegion("defense")); this.attack = new Label(font); this.defense = new Label(font); this.attackR = new Label(font); @@ -57,16 +55,16 @@ public class Engagement extends Bg implements Animation attackR.write(String.format("= %2d", e.attack)); defenseR.write(String.format("= %2d", e.defense)); if (e.success) - winner = ((e.attacker == Army.US) ? usWinner : geWinner); + winner = ((e.attacker == Army.US) ? usFlag : geFlag); else - winner = ((e.attacker == Army.US) ? geWinner : usWinner); + winner = ((e.attacker == Army.US) ? geFlag : usFlag); float resultW = attackR.getWidth(); float w = defenseR.getWidth(); if (w > resultW) resultW = w; - float height = (okBtn.getHeight() + (2 * usFlag.getHeight()) + (4 * padding)); - float width = (usFlag.getWidth() + (2 * d1Animation.getWidth()) + attack.getWidth() + resultW + (6 * padding)); + float height = (okBtn.getHeight() + attackImg.getHeight() + defenseImg.getHeight() + (4 * padding)); + float width = (attackImg.getWidth() + (2 * d1Animation.getWidth()) + attack.getWidth() + resultW + (6 * padding)); float x = position.getX(width); float y = position.getY(height); set(x, y, width, height); @@ -77,23 +75,21 @@ public class Engagement extends Bg implements Animation x += padding; y += (okBtn.getHeight() + padding); - Sprite flag = ((e.defender == Army.US) ? usFlag : geFlag); - flag.setPosition(x, y); - x += (flag.getWidth() + padding); - y = (y + (flag.getHeight() / 2.0f) - (defense.getHeight() / 2.0f)); + defenseImg.setPosition(x, y); + x += (defenseImg.getWidth() + padding); + y = (y + (defenseImg.getHeight() / 2.0f) - (defense.getHeight() / 2.0f)); defense.setPosition(x, y); defenseR.setPosition((getX() + width - resultW- padding), y); x = getX() + padding; - y += flag.getHeight() + padding; - flag = ((flag == geFlag) ? usFlag : geFlag); - flag.setPosition(x, y); - x += (flag.getWidth() + padding); + y += defenseImg.getHeight() + padding; + attackImg.setPosition(x, y); + x += (attackImg.getWidth() + padding); d1Animation.set(e.d1, x, y); x += (d1Animation.getWidth() + padding); d2Animation.set(e.d2, x, (y)); x += (d1Animation.getWidth() + padding); - y = (y + (flag.getHeight() / 2.0f) - (attack.getHeight() / 2.0f)); + y = (y + (attackImg.getHeight() / 2.0f) - (attack.getHeight() / 2.0f)); attack.setPosition(x, y); attackR.setPosition(defenseR.getX(), y); @@ -134,13 +130,13 @@ public class Engagement extends Bg implements Animation { if (!visible) return; super.draw(batch); + attackImg.draw(batch); + d1Animation.draw(batch); + d2Animation.draw(batch); attack.draw(batch); + defenseImg.draw(batch); defense.draw(batch); defenseR.draw(batch); - geFlag.draw(batch); - usFlag.draw(batch); - d1Animation.draw(batch); - d2Animation.draw(batch); okBtn.draw(batch); if (d1Animation.isDone() && d2Animation.isDone()) { attackR.draw(batch); diff --git a/data/assets/hud/attack.png b/data/assets/hud/attack.png Binary files differnew file mode 100644 index 0000000..ca4766b --- /dev/null +++ b/data/assets/hud/attack.png diff --git a/data/assets/hud/defense.png b/data/assets/hud/defense.png Binary files differnew file mode 100644 index 0000000..cf6e580 --- /dev/null +++ b/data/assets/hud/defense.png |