Level Management - UQdeco2800/2021-studio-6 GitHub Wiki

Description

The Game consists of three levels and one safehouse game area, as the player finishes a level and enters (collide) the safehouse, the player will first be transported into the safehouse and exits the safehouse via a door entity inside the safehouse. Once exited, the player will be brought to the next level and continues on with the game.

Programming

To do this, four (game area) classes are needed

  • ForestGameArea: The pre-coded area given
  • Level2: the Level 2 of the game, it is currently a duplicate of ForestGameArea where its entities are used as placeholders, but will be changed in the later sprint.
  • Level3: the Level 3 of the game, it is currently a duplicate of ForestGameArea where its entities are used as placeholders, but will be changed in the later sprint.
  • Safehouse: A game area where player can rest without enemies spawning, this can be later coded into a store where player can purchase items and rest before continue on with the game

A couple functionality is also needed to make sure the level transition works properly

  • Collision: When the player collide with the safehouse, it will trigger an event which changes a value inside the MainGameScreen class that will trigger a method that handles game area transition
  • Generate new Level: This will be handling the level transition within the game. the MainGameArea will have a value called currentLevel which indicates which game area the player should go to. When the value is a whole number, they will be transported to the respective level. If the number ends with 0.5, they will be transported to the safehouse area. This way, it can make sure that there is a safehouse in-between each level.

This method of implementation also allows easy modification if more areas are needed.