Winning The Game (GG) - UQdeco2800/2021-studio-2 GitHub Wiki

Overview

After killing Odin he will spawn an entity winCondition(), on top of his body, which is the portal to take the player to the win Screen. The portal has a touchComponent called touchWin that triggers an event gameWin that the player has and will trigger triggerWin in PlayerWin component that the palyer has. In the MainGameScreen it checks a boolean value in PlayerWin component to see if it is true, if so then it sets the Screen to the END_SCREEN

UML class diagram

Spawning the Win Portal Class Diagram

Odin entity has the deathPauseTask which retrieves the gameArea using the ServiceLocator and calls the spawnEntityAt method to spawn the portal to take the player to the win screen

Triggering the Win Screen

The portal entity has the TouchWin component and when it detects the players collision hitbox it triggers an event called gameWin. The player entity has a component called PlayerWin that calls the method triggerWin on this event. MainGameScreen checks for the boolean value in PlayerWin and if its true it will call setScreen to the win screen.

UML sequence Diagram

spawning Win Portal sequence Diagram

triggering Win Screen sequence Diagram

WhY?