diff --git a/TODO.md b/TODO.md index 5de8f8c..c7e590d 100644 --- a/TODO.md +++ b/TODO.md @@ -42,7 +42,6 @@ Battle ------ * Investigate cooldown not resetting properly the usage count -* Replace success factor percentage with a bar * Add a voluntary retreat option * Add scroll buttons when there are too many actions * Toggle bar/text display in power section of action bar diff --git a/graphics/exported/battle/actionbar/power-generated.png b/graphics/exported/battle/actionbar/power-generated.png new file mode 100644 index 0000000..1d57e74 Binary files /dev/null and b/graphics/exported/battle/actionbar/power-generated.png differ diff --git a/graphics/exported/battle/hud/ship-success-back.png b/graphics/exported/battle/hud/ship-success-back.png new file mode 100644 index 0000000..59aac92 Binary files /dev/null and b/graphics/exported/battle/hud/ship-success-back.png differ diff --git a/graphics/exported/battle/hud/ship-success-fill.png b/graphics/exported/battle/hud/ship-success-fill.png new file mode 100644 index 0000000..ac66243 Binary files /dev/null and b/graphics/exported/battle/hud/ship-success-fill.png differ diff --git a/graphics/ui/battle.svg b/graphics/ui/battle.svg index aaa54cf..eb870d9 100644 --- a/graphics/ui/battle.svg +++ b/graphics/ui/battle.svg @@ -18,13 +18,29 @@ version="1.1" inkscape:version="0.92.1 r15371" sodipodi:docname="battle.svg" - inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/actionbar/background.png" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/battle/actionbar/power-generated.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96" style="enable-background:new" enable-background="new"> + + + + + @@ -2833,6 +2849,357 @@ y1="123.97214" x2="111.73327" y2="123.97214" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml - + @@ -2925,6 +3292,24 @@ width="100%" height="100%" transform="rotate(75,864.85174,532.53795)" /> + + + inkscape:label="New ship HUD" + style="display:inline"> - - - - - - @@ -3207,28 +3571,6 @@ inkscape:export-xdpi="96" inkscape:export-ydpi="96" /> - - - - - - + transform="translate(-194.15008,-152.18179)"> + sodipodi:nodetypes="ccccccc" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/battle/hud/ship-success-back.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" /> + + + style="display:none"> - - + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/battle/actionbar/power-generated.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" + transform="matrix(0.78107246,0,0,1.2558385,1575.6416,-121.92861)" /> { let sprite = new ArenaShip(this, ship); - this.layer_ships.add(sprite); + (ship.alive ? this.layer_ships : this.layer_garbage).add(sprite); this.ship_sprites.push(sprite); }); } diff --git a/src/ui/battle/Targetting.ts b/src/ui/battle/Targetting.ts index deb15df..7433afc 100644 --- a/src/ui/battle/Targetting.ts +++ b/src/ui/battle/Targetting.ts @@ -127,14 +127,13 @@ module TK.SpaceTac.UI { ships.forEach(iship => { let builder = new UIBuilder(this.view, impacts); - let indicator = builder.image("battle-hud-ship-impacted", iship.arena_x, iship.arena_y); - indicator.anchor.set(0.5, 0.5); + let indicator = builder.image("battle-hud-ship-impacted", iship.arena_x, iship.arena_y, true); if (action instanceof TriggerAction) { let success = action.getSuccessFactor(ship, iship); builder.in(indicator, builder => { - builder.text(`${Math.round(success * 100)}%`, 0, -32, - { center: true, color: "#c69b70", size: 14, shadow: true }); + builder.image("battle-hud-ship-success-back", -29, -50); + builder.valuebar("battle-hud-ship-success-fill", -28, -49).setValue(success, 1); }); } }); diff --git a/src/ui/common/UIBuilder.ts b/src/ui/common/UIBuilder.ts index 72c77ba..63ebcc7 100644 --- a/src/ui/common/UIBuilder.ts +++ b/src/ui/common/UIBuilder.ts @@ -169,7 +169,7 @@ module TK.SpaceTac.UI { let result = this.game.add.image(x, y, info.key, info.frame); result.name = name; if (centered) { - result.anchor.set(0.5) + result.anchor.set(0.5); } this.add(result); return result; @@ -198,6 +198,15 @@ module TK.SpaceTac.UI { return result; } + /** + * Add a value bar + */ + valuebar(name: string, x = 0, y = 0, orientation = ValueBarOrientation.EAST): ValueBar { + let result = new ValueBar(this.view, name, orientation, x, y); + this.add(result.node); + return result; + } + /** * Add a fragment shader area, with optional fallback image */