Map Transition Design - UQdeco2800/2022-studio-2 GitHub Wiki
The design of the transition between maps is critical to enable progression for the player throughout the game. This requires a 'Win Condition' for each map, that will unlock the 'Doorway' enabling travel to the next map.
Theme
To suit the story of the plumber, the 'Doorway has been designed as a plug hole, with a plug blocking the way.
Functionality
For initial implementations, the plug hole was implemented as part of the map, whilst the plug was spawned as an Entity (commit). This would allow it to be moved (pushed by the player initially) and then move in response to the game. This provided foundational work so that the entity could react in the future to a 'Win Condition' being met (i.e. a boss being killed).
Trigger
The trigger for the map transition is the Enter key, however requires the player to be standing on the central plug. This was written in the KeyboardPlayerInputComponent() class.
Listener
The listener for this trigger is created in the class TransitionMapComponent(), in the create() method: entity.getEvents().addListener("nextMap", this::nextMap);
This listener calls the nextMap method which gets the MainGameScreen's current map, which determines which map will be transitioned to.
Transition
In order to transition to the next map, the current map's Entities must be disposed of. However one of the issues I was having was that the core entities like the UI were being disposed of, so the ForestGameArea dispose() method was adjusted to omit this.
Revised Functionality
Nearing the stage of completing the game, the transition from Forest Game to Underground Game has been updated to include an animation by Team 6 - Story / Player. The plug hole is still going to be the main conditional, where the user is required to be on top of it. The map design has been updated and the plug hole is no longer an entity, but is now embedded into the map with the generation of the TMX file.
This allows programmers to simply check the users location and not have to worry about spawning it as an entity and creating further interactions in the game. This now provides a foundation to further build upon, as in create further conditional checks such as a condition to asset whether the level boss is alive or not and so on. Ultimately, certain conditions must be met in order to progress onwarads to the level below
Transition
Team 6 has produced a feature that consists of displaying mutliple images one after the other once the mapTransition "effect" is triggered. Map Transition - Loading Next Level Map Transition - Implementation of Next Level Transition
Transition - UML Sequence Diagram
With assistance from Team 6 and after an attempt to understand how the whole transition process is executed, the Sequence Diagram below depicts the transition sequence in a visual manner to assist the general audience in understanding what is occuring when transitioning from Forest Game to Underground Game.