Class World

java.lang.Object
  |
  +--World

public class World
extends java.lang.Object

This class represents the whole world. It constructs the Rooms, the Things, the Player, and it puts the Things and the Player into the Rooms.

To create an adventure game, replace the Things and Rooms in this class with something more interesting. Give the Things some more interesting behaviors, and give the Player some kind of a goal.

Author:
David Matuszek

Field Summary
(package private) static Room startingLocation
           
(package private) static World world
           
 
Constructor Summary
private World()
          Constructor for objects of class World.
 
Method Summary
static Room makeWorld()
          Create the world.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

world

static World world

startingLocation

static Room startingLocation
Constructor Detail

World

private World()
Constructor for objects of class World. The constructor is private, so it cannot be called from another class; to create a world, call makeWorld().

The reason for doing things this way is to make it impossible to create more than one World. If you can call a constructor, it WILL construct an object of that type; but a method such as makeWorld() can be written to call the desired constructor once and only once.

Method Detail

makeWorld

public static Room makeWorld()
Create the world. The world doesn't actually contain any information; the real purpose is to create the Things and Rooms.
Returns:
the Room in which the Player is to start out.