Game Over Screen buttons and function implementation - UQdeco2800/2021-ext-studio-2 GitHub Wiki

Overview

The main part of this feature is located in MainMenuActions.java, GameOverDisplay.java, MainGameScreen.java. This allows when the player dies (health = 0) to show game over screen. When the game over screen shows up, player can see total points collected. Also player can choose to play again or back to the main menu.The GameOverDisplay is located in component/gameover package. There are two files in it. They can be divided into logic section and UI section.

Logic section

Back to the main menu button

  • we declare a new button: "mainMenuButton" and with mainMenuButton.ADDListener(), player can choose to come back to main menu when the character die and gameover screen show up.

  • This similar with "playAgainButton" to choose to play again.

  • Also we when onGameOver() in MainMenuActions.java launch and show game over screen.

  • In GameOcerScreen.java , we use 'public class ... extends' is the format of reference MainMenuScreen.java. There is a function 'setPoints' show the points earned by the character. We refer to the content of MainMenuScreen.java for the rest of the code.

Connect with Scoring system (team9) to show total points collected when game overcreen show up.

  • The situation is when player is dead. The scoring system check if health values is less than zero in the PlayerStatusDisplay update player health value method. If true then stop the timer => we have the total score. note: because time so the return type is long.

  • In GameOverDisplay.Java we call "ScoringSystemV1" and use "getScore" method to show the total score player collected until dead.


Connect with Health system (team2,Issue 35) to show game overscreen when health=0 -> player dead.

  • Call "CombatStatsCompomemt" to have the health status of the character.

  • Create playerStats.isDead() to display game overcreen when health return to zero.


Display Section

  • Like every game overscreen when it pop-ups. We have " game over " title on top, below that is "points" to show points collected, click to main menu button to return to main menu, click to play again to play again.
  • Buttons is paint with green colour.
  • We create a table to set text scale, color, text button(playAgain button etc), position components etc.. At the same time, I also set pointText not to be filled manually.

Future implementations

In the following sprints. We might need to layout and fix to get a better-looking game overscreen. Also, add other functions if needed such as view rankings, save game,....