Skip to content

Revamp InitialScreenDisplay Class

JivalX edited this page Oct 19, 2023 · 1 revision

InitialScreenDisplay Class

Introduction

The InitialScreenDisplay class is a user interface component used to display the initial story sequence in a game developed using LibGDX. It combines background images, text animation, and navigation buttons to create an engaging and immersive storytelling experience for players. The improvement done in this sprint is by refining it in a slide show by running an array list to display images.

image

Description

Class Structure

The InitialScreenDisplay class serves as the initial story sequence UI component and offers the following features:

  • Displaying a sequence of background images.
  • Animating text letter by letter.
  • Providing navigation buttons for users to interact with the story sequence.

Features

  • Integration of letter-by-letter text animation.
  • Implementation of "Next," "Previous," and "Skip" buttons for user interaction.
  • A table-based layout for organizing UI elements effectively.

In-Game Usage

  • Asset being used: InitialScreenImages that consist of the player companion and the ship.

  • Implementation:

The InitialScreenDisplay class is used to display a sequence of background images and textual content in a story-driven game.

Dependencies

The InitialScreenDisplay class depends on several external libraries and assets. The following libraries and assets are used:

  • LibGDX for game development.
  • BitmapFont for text rendering.
  • Texture for handling image assets.
  • AssetManager for loading assets.
  • Table and Label for organizing and displaying UI elements.
  • ImageButton for creating navigation buttons.

Usage

Here's how the InitialScreenDisplay class is used:

  1. Initialization: We create an instance of the InitialScreenDisplay class, providing essential parameters such as the game instance, asset paths, and text list.
  2. Event Listeners: We add event listeners to respond to user interactions with the navigation buttons.
  3. Initialization: The create() method is called to initialize the UI components.
  4. Configuration: We configure the layout of the story sequence using the addUIElements() method.
  5. Navigation Buttons: We create and add navigation buttons for user interaction.

Methods

`The class provides various methods, including:

  • create(): Initializes the class and UI elements.
  • addUIElements(): Adds background images, an animated planet, and text labels.
  • printTextLetterByLetter(String text, Label label, float speed, float initialDelay): Prints text letter by letter with specified speed and initial delay.
  • nextScene(): Progresses to the next scene when the "Next" button is clicked.
  • prevScene(): Goes back to the previous scene when the "Previous" button is clicked.
  • onSkip(): Allows skipping to the game by initiating planet travel.
  • draw(SpriteBatch batch): Handles drawing of UI components on the screen.
  • update(): Manages the movement logic for the animated planet and text animation.
  • dispose(): Cleans up resources and disposes of objects.

Class Code

  • printTextLetterByLetter(String text, Label label, float speed, float initialDelay):
image
  • nextScene():
image

Conclusion

In conclusion, the InitialScreenDisplay class is a vital part of our game's storytelling experience. It combines dynamic elements like text animations and navigation buttons to engage players from the beginning. Its effective layout and usage of external libraries make it a valuable asset in our game development project.

Clone this wiki locally