Building Health Bars - UQdeco2800/2022-studio-3 GitHub Wiki

This page refers to friendly building health bars displayed in the UI Box. For friendly units and enemy entity health bars, refer to Entity Health Bars

Building Health Bars

Examples of what the health bars look like.

Stat Display Design Process

The red colour in the progress bar was changed to a lighter red as it was too bright.

Originally the attack and defense progress bar designs were used however it was realised that attack and defense stats are a static metric that do not need progress bars.

It was then decided that icons should be used to represent attack and defense stats of a building

Functionality

The health bars are configured in BuildingUIDataComponent.createHealthBar()

Creation sequence of Building Health Bar

The health bar frame is created as an Image with the texture loaded from the ResourceService. A 1px wide Pixmap is created which is just a red rectangle that is use for creating the ProgressBarStyle. This Pixmap is the health which is displayed by the ProgressBar. A Label is created to display the hit points of the building as well. The position of the Image, ProgressBar and Label are all configured in this function. Finally, an event listener is registered to know when the entity's health is updated.

HealthBarComponent_create