-
Notifications
You must be signed in to change notification settings - Fork 0
Day and Night Cycle Clock UI
Jump to a section or return to Day and Night Cycle Summary here!
The clock acts like a source of information to keep the player updated with the changes bought in by the DayNightcycle. The method of approach taken to achieve this was through the implementation of UI. The DayNightClockComponent works as an attachment to the MainGameScreen. The implementation is similar to the other UI elements present in the game.
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.
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);
}
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.