MaingameLevel Factory - UQcsse3200/2024-studio-1 GitHub Wiki

Class overview

The MainGameLevelFactory is a crucial component in our game's level generation system, implementing the LevelFactory interface to create the main game levels.

Key Components

  • Default Map Size: Set to 40, determining the standard size of each level.
  • LevelMap: Generates the layout and connections between rooms.
  • RoomFactory: Creates individual rooms with specific contents.
  • NPCFactory: Generates non-player characters for rooms.
  • CollectibleFactory: Creates collectible items for rooms.
  • TerrainFactory: Generates terrain features based on the level number.

Core Methods

  1. create(int levelNumber) Creates a new Level object with a unique map and set of rooms. Generates standard rooms and a special boss room. Returns the fully constructed Level object.

  2. getCurrentLevel()
    Returns the current level number

Implementation Methods

  • Uses a seed-based LevelMap for consistent, reproducible level generation.
  • Creates a HashMap of rooms, each with unique properties based on their position and level number.
  • Includes a special "BOSS" room in each level.

Usage

image

UML

image

Sequence Diagram

image