Character Select Screen Animations - UQcsse3200/2024-studio-1 GitHub Wiki
The objective of this task is to animate the players on the select screen to enhance the game and give the players a personality. Upon navigating to the Player Select screen, the PlayerSelectAnimation class is called to load and draw the animations for each character.
The current rendition involves:
The PlayerSelectDisplay
class has been implemented for handling the UI for the Player Select screen. Within this class, the PlayerSelectAnimation is called to add the player animations to the table. In addition, a new AnimationRenderComponent was added within the addActors function to enable animations.
This class has been implemented to extend from Actor and draw each frame of the animation. This class receives both the AnimationRenderComponent
and the Player config files. From the config file, the player atlas file is mapped to the PlayerNum enum to simplify the code and easily distinguish between the players. The AnimationRenderComponent
is then used to add the required animations, render them and start the animation.
To be able to render the animation in the PlayerSelectAnimation
, the addition of the update(float Delta) and getCurrentFrame() function were added to the AnimationRenderComponent
. The getCurrentFrame() returns the current Texture Region being animated. The update(float Delta) is used to keep track of the time passed since the last drawn frame.
The UML diagram for the PlayerSelectAnimation class
The sequence diagram for the startAnimation function:
The sequence diagram for the draw function:
The player animation should be contained within a png file, and the associated atlas file needs to be generated.
Note: To set up the animations, refer to Animations.
The following is an example of how the "special" animation is set up for a Player.
Add player as Player1
public enum PlayerNum {
Player1,
}
private PlayerNum mapTextureAtlasToPlayerNum(String textureAtlas) {
return switch (textureAtlas) {
case "images/player/player.atlas" -> PlayerNum.Player1;
}
The "special" animation needs to be added. Since it should be constantly playing, the PlayMode is set to LOOP.
initializeAnimations() {
animator.addAnimation("special", 0.2f, Animation.PlayMode.LOOP);
}
Start the animation with the added animation
public void startAnimation() {
String animationName = switch (player) {
case Player1 -> "special";
};
animator.startAnimation(animationName);
}
}
Linked below is the sample testing of the working of the player select animations.
(As of 25 Sep. 2024)
Screen.Recording.2024-10-02.095441.mp4
Test Plan Manual UI Testing Plan
Objective: To verify the animation is working for each character on the Select Screen.
Scenario 1: Walk-direction triggers play the correct animation Task: Stay on the select screen. Expected Outcome: The animations for every character should start.
Scenario 2: Damage triggers play the correct animation Task: Start the game and play, before exiting and moving back to the select screen. Expected Outcome: The animations for every character should start.
Below is the citation for the use of the assets.
Bagong Games: Hana Caraka - base character by Bagong Games, itch.io. (5 March 2024)
Available at: https://bagong-games.itch.io/hana-caraka-base-character (Accessed: 20 August 2024).
Free Homeless Pixel Sprite Sheets, itch.io.
Available at: https://free-game-assets.itch.io/free-homeless-character-sprite-sheets-pixel-art (Accessed: 20 September 2024).