Level Map - UQcsse3200/2024-studio-1 GitHub Wiki
The LevelMap
class plays a crucial role in managing the game world’s map data, including handling the loading, exporting, and retrieval of information related to room connections, items, and animals. This class facilitates the dynamic generation of map layouts and ensures that the relationships between different rooms are maintained during gameplay.
-
Map Loading & Exporting: The
LevelMap
allows creation of a new map using theMapGenerator
class. -
Room Connection Management: This class manages the connections between rooms, enabling the retrieval of all connected rooms or specific connections based on various criteria.
-
Entity Management: The
LevelMap
class is responsible for managing the placement of animals and items within rooms, ensuring that the correct entities are spawned in the right locations. -
Player Positioning: It provides functionality to retrieve the starting position of the player, ensuring proper placement at the beginning of the game or when loading a saved state.
-
Map Properties: The
LevelMap
class handles key map properties such as the seed used for map generation and the overall map size, which are essential for consistent map creation and gameplay boundaries.
LevelMap levelMap = new LevelMap("someSeed", 100);
levelMap.loadMap(null); // Loads map using MapGenerator
List<String> connections = levelMap.getRoomConnections("0_0");
String playerLocation = levelMap.getPlayerLocation();
int animalIndex = levelMap.getAnimalIndex("1_1");
This example demonstrates how to create a LevelMap
, load a map, and retrieve room connections, player location, and animal indices, illustrating the core functionality of the class in a practical context.
Below is a UML diagram showcasing the relationship between the LevelMap
class and other key classes within the game. This diagram highlights the interaction and dependencies that exist between the LevelMap
and other components responsible for room creation, map generation.
This documentation provides an overview of the LevelMap
class and its dependencies, focusing on its primary functions and the role it plays in the overall game architecture.