|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Room
This interface specifies how all Rooms in the game must be built. All rooms must have the methods declared here defined within their classes or the game will not compile. Inheriting from this class does not limit rooms to these methods however; more can easily be added.
To create another room, create a new class that implements the Room interface. Make sure your class has all these methods.
| Method Summary | |
|---|---|
void |
draw(GameState game,
java.awt.Graphics g,
int windowWidth,
int windowHeight)
Draws the room to the screen. |
java.lang.String |
getName()
Returns the name of this room object as a String. |
void |
outputDescription(GameState game,
OutputPanel output)
Prints text describing this room to the output panel. |
boolean |
takeAction(GameState game,
OutputPanel output,
java.lang.String verb,
java.lang.String noun)
This method is called when the user enters a command. |
| Method Detail |
|---|
java.lang.String getName()
Students may often call this method.
void outputDescription(GameState game,
OutputPanel output)
It would be uncommon for students to call this method.
game - the GameState object that is running / keeping track of this gameoutput - the output panel where text will be added
boolean takeAction(GameState game,
OutputPanel output,
java.lang.String verb,
java.lang.String noun)
This method should return false if the command was not processed here. It should return true if the command was processed here.
It would be uncommon for students to call this method.
game - the GameState object that is running / keeping track of this gameoutput - the output panel where text will be addedverb - the verb of the action, such as "get"noun - the noun of the action, such as "batteries"
void draw(GameState game,
java.awt.Graphics g,
int windowWidth,
int windowHeight)
It would be uncommon for students to call this method.
game - the GameState object that is running / keeping track of this gameg - the Graphics object to do the drawingwindowWidth - the width of the windowwindowHeight - the height of the window
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||