Repository navigation
Win screen
The Win Screen is the popup shown when the player defeats Zeus. It stops the game world, tells the player how well they won, and offers Play Again and Main Menu.
The first version (September) only said YOU WIN!. Since the win system was added in October it shows the player's win tier (Victory, Glory or Legend), how many guardians, quests and tortoises they completed, and what is still missing from the top tier. How the tier is worked out is on the Win System page, and where the tortoises come from is on the Tortoise System page.
During development the screen can be shown with the win terminal command, and Zeus can be killed with the killzeus command. See Debug Terminal.
From top to bottom:
| Line | Text | Where it comes from |
|---|---|---|
| Title | the tier's title in capitals: VICTORY, GLORY or LEGEND
|
WinTier.getTitle() |
| Subtitle |
Zeus has fallen., Every guardian has fallen. or Every guardian has fallen and every quest is done.
|
WinTier.getSubtitle() |
| Rank | Rank n of 3 |
rankText |
| Guardians | Guardians defeated: x of 8 |
guardiansText |
| Quests | Quests completed: x of 3 |
questsText |
| Tortoises |
Tortoises found: x of y, followed by - Tortoise Champion when every one was found; Tortoises found: none are hidden yet when the game hides none |
tortoisesText |
| Missing |
Still standing: then up to four guardian names, then and n more; then n more quest or n more quests
|
missingText |
| Buttons | Play Again and Main Menu | unchanged |
The missing section is empty at Legend. It names guardians first and quests second, because the guardians are what lift Victory to Glory and the quests lift Glory to Legend.
LEGEND
Every guardian has fallen and every quest is done.
Rank 3 of 3
Guardians defeated: 8 of 8
Quests completed: 3 of 3
Tortoises found: 7 of 7 - Tortoise Champion
[ Play Again ]
[ Main Menu ]
VICTORY
Zeus has fallen.
Rank 1 of 3
Guardians defeated: 5 of 8
Quests completed: 1 of 3
Tortoises found: 2 of 9
Still standing:
Cerberus
Medusa
Minotaur
2 more quests
[ Play Again ]
[ Main Menu ]
(The second example is an illustration of the layout. The names in the "Still standing" list come from the roster, in roster order.)
Zeus dies
v
BossDefeatedWinComponent announces it, LevelGameArea notes it
v
MainGameScreen waits 2.5 seconds (WinCountdown) so the death is seen
v
WinEvaluator.evaluateNow(true) -> WinResult (tier, counts, what is missing)
v
WinScreenDisplay.showWinScreen(WinResult)
showWinScreen() with no argument shows the screen for the game as it stands right now, with the final boss counted as defeated. The win command uses it, so the screen can be checked without killing Zeus. showWinScreen(WinResult) shows one specific outcome and replaces any text from an earlier showing.
WinScreenInputComponent (added with the keyboard navigation for the Death and Win screens in September) lets the player use the keyboard: Up and Down move the highlight between the two buttons (and wrap round), and Enter or Space presses the highlighted one. Play Again is selected first. Both buttons also work with the mouse.
- Play Again starts a new game from the main game screen.
- Main Menu returns to the main menu.
While the screen is visible the game world stops updating, in the same way as the Death Screen and the Pause Menu. isVisible() lets the input component only react to keys while the screen is showing.
-
WinScreenDisplay.java: builds the popup, fills in the text and handles the buttons. -
WinScreenInputComponent.java: keyboard navigation. -
WinCommand.java: thewinterminal command. -
MainGameScreen.java: runs the countdown and callsshowWinScreen(WinEvaluator.evaluateNow(true)). -
WinTier.java,WinResult.java,WinEvaluator.java(packagecom.csse3200.game.win): the tier, the numbers behind it and the rule that works them out.
Tests were used to ensure the following situations were working:
- The screen starts hidden
- Every count goes on its own label, and the text is replaced when the screen is shown again for a different result
- The tortoise line says none are hidden while none exist, and names the Tortoise Champion when every tortoise is found
- Nothing is listed as missing at Legend
- Up to four missing guardians are named, exactly four have no "and more" line, and more than four are summed up
- The missing guardians are listed first, then the quests still needed, and quests are not mentioned once enough are done
- The
wincommand shows a plain Victory in a fresh game, and the live progress otherwise - Play Again is selected first and starts a new game, Main Menu is reached after moving down once, and moving up from the first button or down twice wraps around
The tier rules behind these lines are tested in Win System.
Run each with the game open and the terminal on F1.
| Test | Steps | Expected result |
|---|---|---|
| Win command | type win
|
the screen appears with the tier for the current game, and the game stops |
| Victory | in Level 3 type killzeus with no side-room guardians killed |
after about 2.5 seconds the screen shows VICTORY, Rank 1 of 3 and a "Still standing" list |
| Glory | kill all eight required guardians, then Zeus | GLORY, Rank 2 of 3, and "n more quests" if fewer than 3 are done |
| Legend | also complete three quests, then kill Zeus | LEGEND, Rank 3 of 3 and no missing section |
| Tortoise Champion | find every tortoise, then win | the tortoise line ends with "- Tortoise Champion" |
| Layout | open the screen with the shop button and inventory visible | nothing covers the popup (bug #348) |
| Play Again | press Enter on Play Again | a new game starts |
| Main Menu | move down, press Enter | the main menu appears |
| Keyboard | press Up and Down | the highlight moves and wraps round |
| First version (September) | Now |
|---|---|
a fixed YOU WIN! title |
the tier's title and subtitle |
| no numbers | rank, guardians, quests and tortoises |
shown by the win command only |
shown automatically when Zeus dies, as well as by win
|
showWinScreen() only made the popup visible |
showWinScreen(WinResult) fills in the text, then makes it visible |
Keyboard navigation, the Play Again and Main Menu buttons and the pausing behaviour were already there and are unchanged. The tortoise line now counts the planned tortoises from the Tortoise System.