From 5524d4d45ba7541ba2bb0dfec70f3cd3af597c1e Mon Sep 17 00:00:00 2001 From: RyanGrieb Date: Thu, 16 Nov 2023 10:09:33 -0600 Subject: [PATCH] City: Add civ icon adj. to city name --- client/src/city/City.ts | 18 +++++++++++++++++- client/src/scene/Actor.ts | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/client/src/city/City.ts b/client/src/city/City.ts index edc311e0..c0eac4f8 100644 --- a/client/src/city/City.ts +++ b/client/src/city/City.ts @@ -25,6 +25,7 @@ export class City extends ActorGroup { private territory: Tile[]; private territoryOverlays: Actor[]; private name: string; + private civIcon: Actor; private nameLabel: Label; private innerBorderColor: string; private outsideBorderColor: string; @@ -76,10 +77,25 @@ export class City extends ActorGroup { this.nameLabel.setPosition( this.tile.getX() - this.nameLabel.getWidth() / 2 + - this.tile.getWidth() / 2, + this.tile.getWidth() / 2 + + 7, this.tile.getY() - this.nameLabel.getHeight() ); Game.getCurrentScene().addActor(this.nameLabel); + + this.civIcon = new Actor({ + image: Game.getImage(GameImage.SPRITESHEET), + spriteRegion: + SpriteRegion[this.player.getCivilizationData()["icon_name"]], + x: this.nameLabel.getX() - 14, + y: this.nameLabel.getY(), + z: 14, + width: 12, + height: 12, + }); + //this.addActor(this.civIcon); + + Game.getCurrentScene().addActor(this.civIcon); }); for (const tile of this.territory) { diff --git a/client/src/scene/Actor.ts b/client/src/scene/Actor.ts index 0ba7e156..4d9a3fc7 100644 --- a/client/src/scene/Actor.ts +++ b/client/src/scene/Actor.ts @@ -40,7 +40,7 @@ export class Actor implements SceneObject { this.spriteRegion = actorOptions.spriteRegion; this.x = actorOptions.x; this.y = actorOptions.y; - this.z = actorOptions.z ?? 0; + this.z = actorOptions.z; this.width = actorOptions.width; this.height = actorOptions.height; this.rotation = actorOptions.rotation ?? 0;