| Assignment
9: Adventure Game Fall 2006, David Matuszek |
Write a text adventure game.
If you have no idea what I'm talking about, go to www.ifiction.org and play around for awhile.
Most adventure games use commands of two or more words. We're just going to use buttons.
An adventure game consists of:
AdventureGame class.
This class:
main method used to start the game.JFrame and
is the
container for the entire GUI.Adventurer (the
human player).
Rooms. A room has:
Things. A thing has:
Your assignment is to write a small adventure game. By "small" I mean somewhere between four and twelve rooms, and four to eight objects; at least two of the objects should have some "use" relevant to the game. Each partner should do some rooms and some objects. The theme of the game, and the goal of the game, is up to you.
You also need to write a Swing GUI to allow a person to play the game. Although there is only one GUI, I would like each partner to write all the code (creating the components, laying them out, attaching listeners) for part of the GUI. For that reason, I'm dividing the GUI up into four "areas," as follows:
JComboBox, for choosing a particular thing in the roomJButton for looking at the selected thingJButton for picking up the selected thing (and adding
it to the adventurer's inventory)JComboBox, for choosing a particular thing from
the inventory JButton for looking at the selected inventory
itemJButton for "using" the selected inventory
itemJButton for dropping the selected inventory
item (goes into the room)JButtons, for moving to the north, south,
east, or west. Buttons should be disabled if the adventurer
can't go that way. The above division of the GUI is suggested, not absolutely required. You can
rearrange things as necessary to create a good-looking GUI, but each partner
should do all the work for a JComboBox, some JButtons, and a text component.
The classes for the game itself should not do any input/output; in particular, they should not use the GUI in any way. The game should not even "know" the GUI exists. Instead, the GUI should use the classes and methods of the game.
I am providing a sample game, McGame.jar. This
is a very simple game where the main class (McGame)
uses the classes and methods of the game, and does all the (text-only) input/output;
the game does not "know" who is calling it. (Note: you can execute the game
by double-clicking it, or you can change the name to McGame.zip and unpack
it.)
No JUnit tests are required for this assignment.
As always,
When you turn in your program, include a readme.txt file to tell
us how to play your game to a successful completion.
Thursday, November 16, before midnight.