STAIR FACTORY - UQcsse3200/2024-studio-1 GitHub Wiki
Class Overview
The StairFactory class does the work of building and administering stair entities in the game which are the course points between varying levels. This factory class constructs stair entities with the components needed and implements the logic for stage transitions when the stairs are interacted with by a player.
Key components
- Stair Entity: The main entity representing the staircase in the game world.
- Player ID: Tracks the ID of the player entity for collision detection.
- Collision Handling: Manages the interaction between the player and the stair entity.
- Level Transition: Facilitates the process of moving to the next level or restarting the current level according to players response
Core methods
createStair(int idOfPlayer)
- Creates a stair entity with all necessary components and sets up collision handling.createBaseStair()
- Generates a basic stair entity with rendering and physics components.createCollision()
- Sets up the collision listener for player interaction with the stair.MoveToNextLevel()
- Handles the transition to the next level when the player interacts with the stairs.
Usage
Integration with level system
- StairFactory is the LevelFactory partner in the creation of new levels but does not directly deal with the latter.
- The GameArea is most probably implying the use of a LevelFactory to give rise to the next level right after a level update.
- A new
LevelFactory.create(int levelNum)
method would be called involving the new level number and thus forming the next level outline structure. - The StairFactory works with the GameController to manage level transitions.