Repository navigation
Room Manager
The RoomManager class is the main entry point to rooms and acts as a director for the main game. The main gameplay loop will be coordinated by this class. The RoomManager will handle creating room entities and provide api's for switching to different rooms.
A RoomManager class is to be created with a game screen. The player must not be registered before passing into RoomManager. After everything is setup, At the very end of the game screen creation call RoomManager.create().
Once the main gameloop begins, RoomManager internally will coordinate all game behavior.
create() {
// ...
RoomManager roomManager = new RoomManager(worldConfig, player, camera);
// ...
roomManager.create()
}A major code design decision was to convert the GameArea to the ecs entities. The rationale behind this is that in our game we wish to have a series of levels (a room) the player must clear, hence we need a way to quickly make different room variants.
RoomFactory is a static class used to create room entities.
Room factory provides a static function for creating a room entity with components to provide basic functionality.
createRoom(RoomConfig room, CameraComponent camera, boolean cleared)
The RoomConfig params provides instructions for what a room has and allows the following to be declared. See RoomConfig for usage details.
- map size
- player spawn point
- enemy spawn points
- exits
Note: room components does not directly depend on RoomConfig class. createRoom extracts the required values from RoomConfig for the components which lets us maintain encapsulation.
If a room is created with cleared == true then enemies will not be spawned.
- RoomAssetsComponent
- GameAreaDisplay
- TerrainComponent
- WallComponent
- FollowingCameraComponent
- ObstacleComponent
- ExitComponent
- EnemyManagerComponent
todo
- Add outside dependencies to diagram
- Fill out class fields