Skip to content

Commit

Permalink
City: Add civ icon adj. to city name
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGrieb committed Nov 16, 2023
1 parent 9b3f9be commit 5524d4d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion client/src/city/City.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/scene/Actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5524d4d

Please sign in to comment.