1
0
Fork 0

Added graphics for hull, shield and AP display in ship list

This commit is contained in:
Michaël Lemaire 2015-02-28 01:00:00 +01:00
parent 8c85102ccc
commit 0ee65ca0cd
10 changed files with 32 additions and 4 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

View file

@ -17,6 +17,12 @@ module SpaceTac.View {
this.loadImage("battle/shiplist-playing.png");
this.loadImage("battle/shiplist-own.png");
this.loadImage("battle/shiplist-enemy.png");
this.loadImage("battle/shiplist-ap-empty.png");
this.loadImage("battle/shiplist-ap-full.png");
this.loadImage("battle/shiplist-hull-empty.png");
this.loadImage("battle/shiplist-hull-full.png");
this.loadImage("battle/shiplist-shield-empty.png");
this.loadImage("battle/shiplist-shield-full.png");
this.loadImage("battle/background.jpg");
this.loadImage("battle/arena/background.png");
this.loadImage("battle/actionbar.png");

View file

@ -12,6 +12,9 @@ module SpaceTac.View {
// Shield display
shield: ValueBar;
// Action points display
ap: ValueBar;
// Portrait
layer_portrait: Phaser.Image;
@ -58,13 +61,23 @@ module SpaceTac.View {
this.layer_hover.visible = false;
this.addChild(this.layer_hover);
this.hull = ValueBar.newStandard(list.battleview.game, 85, 28);
this.hull.scale.set(0.1, 0.1);
this.hull = ValueBar.newStyled(list.battleview.game, "battle-shiplist-hull", 76, 23);
this.addChild(this.hull);
this.shield = ValueBar.newStandard(list.battleview.game, 85, 46);
this.shield.scale.set(0.1, 0.1);
this.shield = ValueBar.newStyled(list.battleview.game, "battle-shiplist-shield", 76, 35);
this.addChild(this.shield);
this.ap = ValueBar.newStyled(list.battleview.game, "battle-shiplist-ap", 76, 47);
this.addChild(this.ap);
this.updateAttributes();
}
// Update attributes from associated ship
updateAttributes() {
this.attributeChanged(this.ship.hull);
this.attributeChanged(this.ship.shield);
this.attributeChanged(this.ship.ap_current);
}
// Called when an attribute for this ship changed through the battle log
@ -73,6 +86,8 @@ module SpaceTac.View {
this.hull.setValue(attribute.current, attribute.maximal);
} else if (attribute.code === Game.AttributeCode.Shield) {
this.shield.setValue(attribute.current, attribute.maximal);
} else if (attribute.code === Game.AttributeCode.AP) {
this.ap.setValue(attribute.current, attribute.maximal);
}
}

View file

@ -32,6 +32,13 @@ module SpaceTac.View {
return result;
}
// Create a quick styled bar
static newStyled(game: Phaser.Game, base_key: string, x: number, y: number): ValueBar {
var result = new ValueBar(game, x, y, base_key + "-empty");
result.setBarImage(base_key + "-full");
return result;
}
// Build an value bar sprite
// background is the key to the image to use as background
constructor(game: Phaser.Game, x: number, y: number, background: string,