Skip to content

Day and Night Cycle Clock UI

Ella West edited this page Sep 13, 2022 · 14 revisions

Page Navigation

Jump to a section or return to Day and Night Cycle Summary here!

Summary

The clock is a source of information for the player to keep them on top of the day and night cycle. This was implemented as a UI element, DayNightClockComponent, attached to the MainGameScreen UI elements. The clock works similarly to the other UI elements present in the game, but is able to be updated through the EVENT_PART_OF_DAY_PASSED.

Technical

MainGameScreen

The MainGameScreen has the following command for attaching the DayNighClockComponent to the screen and also loads the sprites for the clock. It helps in loading the assets which is further used in the DayNightClockComponent.

    Entity ui = new Entity();
    ui.addComponent(new InputDecorator(stage, 10))
        .addComponent(new PerformanceDisplay())
        .addComponent(new MainGameActions(this.game, MainArea.getInstance().getGameArea().getPlayer()))
        .addComponent(new MainGameExitDisplay())
        .addComponent(new MainGameInterface())
        .addComponent(new MainGameBuildingInterface())
            .addComponent(new DayNightClockComponent())
        .addComponent(new Terminal())
        .addComponent(inputComponent)
        .addComponent(new TerminalDisplay());
    ServiceLocator.getEntityService().registerNamed("ui", ui);

DayNightClockComponent

The function called addClock which takes care of bringing the sprite on and having it displayed using the table and stage commands.

    private void addClock(){
        rightTable = new Table();
        rightTable.top().right();
        rightTable.setFillParent(true);
        rightTable.padTop(60f).padRight(10f);

        //adding it on screen
        rightTable.add(clockImage).left().bottom().size(200f, 200f);

        stage.addActor(rightTable);
    }

Testing

Day Night Clock Demonstration From the above video we can see the functionality of the clock in respect to the game. The clock has its section divided for each part of the cycle which represent the current part of the cycle. It change as the time passes in the game and have the number displayed showing the each cycle pass.


Return to Day and Night Cycle Summary

Table of Contents

Home

How to Play

Introduction

Game Features

Main Character

Enemies
The Final Boss

Landscape Objects

Shop
Inventory
Achievements
Camera

Crystal

Infrastructure

Audio

User Interfaces Across All Pages
Juicy UI
User Interfaces Buildings
Guidebook
[Resource Management](Resource-Management)
Map
Day and Night Cycle
Unified Grid System (UGS)
Polishing

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally