Story Display using Initial Screen - UQcsse3200/2023-studio-2 GitHub Wiki
InitialScreen and InitialScreenDisplay Classes
This Wiki page provides an overview of the InitialScreen
and InitialScreenDisplay
classes in the game project. These classes are responsible for managing the initial screen, loading assets, and creating the user interface for the game's introduction sequence.
Table of Contents
InitialScreen Class
The InitialScreen
class is responsible for managing the initial screen of the game. It handles asset loading, UI creation, and rendering.
Class Structure
logger
: An instance of the SLF4J Logger for logging messages.introScreenAssets
: An array of file paths to image textures required for this screen.game
: The main game instance.renderer
: The renderer responsible for rendering the screen.
InitialScreenDisplay Class
The InitialScreenDisplay
class is a user interface component responsible for displaying the initial story sequence.
Class Structure
game
: The main game instance.font
: BitmapFont for text rendering.textAnimationDuration
: Duration of the text animation.spaceSpeed
: Speed of the planet's movement.planetToTextPadding
: Padding between the planet and the text.background
: Image for the starfield background.planet
: Image for the animated planet.rootTable
: Table for UI layout.tweenManager
: TweenManager for animations.storyLabel
: Label for displaying the story text.
Methods
Text Animation with TweenEngine
One of the key features of the InitialScreenDisplay
class is the text animation that introduces the game's story. This animation is achieved using the TweenEngine library, which provides a powerful way to create smooth and controlled animations. Here's how the text animation works:
private void setupTextAnimation()
-
setupTextAnimation()
: This method configures and starts the text animation using the TweenEngine library. Here's a breakdown of how it works:-
Tween Registration: The class
LabelAccessor
is registered as a TweenAccessor for theLabel
class. This allows the TweenEngine to animate properties ofLabel
instances, such as alpha (transparency). -
Initial Alpha: The initial alpha value of the
storyLabel
(the Label displaying the story text) is set to 0, making it fully transparent. -
Tween Configuration: The
Tween.to
method is used to configure the animation. It targets thestoryLabel
to gradually change its alpha value to 1 (fully opaque) over a duration oftextAnimationDuration
seconds. The animation easing function is set to Quint.OUT for a smooth exit animation. -
Start Animation: The animation is started using the
tweenManager
.
-
Final Output
Dependencies
- LibGDX: The core framework for developing cross-platform games.
References
- We drew inspiration from Studio 1 to enhance our storytelling approach, particularly captivated by their captivating text and image animations. Subsequently, we meticulously overhauled our code, adopting the Universal Tween Engine to gain finer control over our animations. This empowered us to introduce elegant fade-in text animations and extend the duration of our image animations, creating a distinct and engaging visual narrative. It's important to note that our inspiration was solely in crafting a vision for our animation's potential aesthetics, and we did not draw any inspiration from the code, libraries, or Gradle libraries used by Studio 1.
Contributors
-
Yash Mittal @YashMitttal
-
Aniket Gupta @aniketgupta17
-
Neil Barigye @neil-nb