Class ForestGameArea

java.lang.Object
com.csse3200.game.areas.GameArea
com.csse3200.game.areas.ForestGameArea
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class ForestGameArea extends GameArea
A playable “Forest” style room. This class: - Loads assets for this scene - Builds the terrain and screen edges - Spawns the player, props (desk, crates, energy pod), a keycard door, and enemies - Starts background music Think of this as the level assembler as it doesn’t know how to build each object, it just asks the right factories to create them and places them in the world.
  • Constructor Details

    • ForestGameArea

      public ForestGameArea(TerrainFactory terrainFactory, CameraComponent cameraComponent)
      Initialise this ForestGameArea to use the provided TerrainFactory and camera helper. The camera is used to size the screen-edge walls and place the right-side door trigger.
      Parameters:
      terrainFactory - TerrainFactory used to create the terrain for the GameArea (required).
      cameraComponent - Camera helper supplying an OrthographicCamera (optional but used here).
      Requires:
      terrainFactory != null
  • Method Details

    • create

      public void create()
      Entry point for this room. This: - Loads textures/sounds/music - Registers this room in the ServiceLocator - Creates the terrain, walls, and UI label - Spawns player, props (desk, crates, pod), door (with keycard gate), and enemies - Starts background music
      Specified by:
      create in class GameArea
    • spawnItem

      public void spawnItem(Entity item, com.badlogic.gdx.math.GridPoint2 position)
      Overrides:
      spawnItem in class GameArea
    • getPlayer

      public Entity getPlayer()
      Description copied from class: GameArea
      allows manipulation of player character by loading function
      Specified by:
      getPlayer in class GameArea
      Returns:
      player entity
    • toString

      public String toString()
      Overrides:
      toString in class GameArea
    • load

      public static ForestGameArea load(TerrainFactory terrainFactory, CameraComponent cameraComponent)