Class World

java.lang.Object
com.bdtripp.hauntedhouse.model.World

public class World extends Object
Represents the complete game world. Stores the player, all rooms, and the starting location.
Author:
Brian Tripp
  • Constructor Details

    • World

      public World(Player player, Map<RoomName,Room> rooms, Room startingRoom, Item key)
      Create the game world that has a player, rooms, a starting room, key etc.
      Parameters:
      player - the player of the game
      rooms - the rooms in the game
      startingRoom - the room where the game starts
      key - a key that unlocks an exit
  • Method Details

    • getPlayer

      public Player getPlayer()
      Returns the player associated with this world.
      Returns:
      the player of the game world
    • getRooms

      public Map<RoomName,Room> getRooms()
      Returns all rooms that exist in the game world.
      Returns:
      the rooms in the game
    • getStartingRoom

      public Room getStartingRoom()
      Returns the room where the player begins the game.
      Returns:
      the starting room of the game
    • getRoom

      public Room getRoom(RoomName name)
      Get the room that matches a name
      Parameters:
      name - the name of the room
      Returns:
      the room
    • getKey

      public Item getKey()
      Returns the key used to unlock a specific exit in the world.
      Returns:
      the key