-
Notifications
You must be signed in to change notification settings - Fork 0
Base Resource Label
To keep track of the base statistics of the game, a label has been designed which aims to constantly show the resource count in a way that aligns with the Atlantis theme and does not obstruct the players view.
At this stage, it is set up to display the accruing resource count of the player and all entities that can store wood, stone and metal. It can be modified to include currency or any other base stats to be decided.
Tracking: Track the overall count of resources/currency and display them
Extension: Can be modified to include other game statistics such as health if required.
public class ResourceCountDisplay extends UIComponent {
private Label goldCoinLabel;
private Image goldCoinImageLabel;
/* Modify these to update the resource count */
private int goldCoinCount = 100;
Step 2: Update the addActors()
method to include each new resource. Be sure to use a font scaling of 1.5f to ensure consistency. Any images or icons should be sized 40 x 40. Don't forget to add the actors to the stage. An example is given below.
private void addActors() {
goldCoinLabel = new Label(String.format(" %d", goldCoinCount), skin);
goldCoinImageLabel = new Image(ServiceLocator.getResourceService().getAsset("images/gold-coin.png", Texture.class));
goldCoinLabel.setFontScale(1.5f);
goldCoinImageLabel.setSize(40, 40);
stage.addActor(goldCoinLabel);
stage.addActor(goldCoinImageLabel);
Note: In the existing code, increase the resourceLabel HEIGHT to extend the background image.
Step 3: Add the new resource to the draw()
method, as shown in existing code. On the x axis, resource image icons need to be offset by 20f whilst text needs to be offset by 10f. The image icons and the text icons have a difference of 10f on the y axis as shown below
private void draw(SpriteBatch batch) {
int screenHeight = Gdx.graphics.getHeight();
int screenWidth = Gdx.graphics.getWidth();
float offsetX = 10f;
float offsetY = 80f;
goldCoinImageLabel.setPosition(screenWidth - 200f + 20f, screenHeight - offsetY - 90f);
goldCoinLabel.setPosition(screenWidth - 200f + 50f + 10f, screenHeight - offsetY - 80f);
Step 4: Add each resource to the updatePlayerResourceUI(String resource, int count)
method. Add each actor to the dispose()
method.
This is straightforward, just add the line case "goldCoin -> goldCoinCount = count
;
Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback