Assignment 4: Adventure Game

Create a reusable framework for an adventure video game.  Define base classes Player, Monster, and Game (clients will extend these classes if necessary).  There is always exactly one Player per Game.  There may be an unlimited number of Monsters.  By default, a game consists of Monsters appearing occasionally at random and attacking the Player.  Each time the Player is attacked, he or she loses a random number of "health points" and the Monster also loses a random number of health points.  When a Monster's health points drops to 0, it is removed from the game.  When the Player's health points drop to 0, the game is over.

The Game should manage a window (either an applet or a standalone frame) with a graphical representation of the Player and Monster(s); each Player and each Monster should manage its own appearance via a draw() method.  (See the second graphics demo for an example of drawing multiple objects.)  Monsters can attack the Player only when they are touching the Player. You an use any reasonable method for making the Monsters chase the Player, and letting the user move the Player.

The framework should allow for a default Monster subclass, set with setDefaultMonster(). Use the Prototype pattern using a Monster subclass instance as the prototype.

Create the framework along with a test program that extends Monster and calls setDefaultMonster() at least once.  Make sure that the framework is independent of the test program.  Feel free to add additional monster subclasses, change them during the program's execution, etc.  (The framework should support switching the type of monster that will appear next.)

Deliverables: Turn in a class diagram, the code, any println output, and a screen shot of your program. (Under Windows, you can copy screen images to the Clipboard with Control-PrtScn, then paste to an application like Paintbrush for printing.)