COSC 231 Project #4 Battle for Gold

Date distributed: 23 March 2015
Date due: 8 April 2015

Assignment

Move a hero around a rectangular area (the world) under control of keyboard input, retrieving gold and battling monsters.

Power Station

The Power Station is located in the middle of the world and occupies 10 X 10 pixels. Gold and monster cannot be co-located with the Power Station. The Power Station is always displayed, unless the hero moves on top of it.

Hero

The hero is 10 X 10 pixels. The hero is not allowed beyond the edges of the rectangular area. There is no wrap-around. The hero moves according to the rules given in Project #3, with an additional rule given here:
   The hero it not allowed to occupy the same space as a monster. The monster must be killed before the hero can move into its space.

The hero has a starting health value of 100. Health value is diminished when the hero is hit by a monster. Health value is replenished to 100 when the hero moves onto the Power Station. The hero is always displayed.

Gold

At least 5 caches of gold are randomly located on the board. Sitting on top of each gold cache is a monster. Gold will be displayed when the game is initialized, and remains displayed until either (1) the hero picks it up (by moving on top of it), or a monster, sitting on top of the gold, is revealed.

Monster

A monster is 10 X 10 pixels. Monsters are hidden until they strike at the hero. Each cache of gold has a monster sitting on top of it. Whenever the hero moves within striking range of a monster (i.e., neighboring 10X10 pixels: N, NE, E, SE, S, SW, W, NW), the monster will hit the hero, with a cost to the hero's health as given below. The hero strikes at a monster by attempting to move on top of the monster. The hero and the monster cannot occupy the same space, so the hero cannot move onto the monster's space (and therefore cannot collect the monster's gold) until the monster is defeated.

There are two kinds of monsters:

The different monster types will have a different look (two different looks).

Initial board

When a game is initialized, the hero, the Power Station and the gold are visible. The world is 200 X 200 (or bigger). The gold (and corresponding monster) caches are randomly located (not on top of Power Station). The hero cannot be initialized on top of gold nor on top of Power Station. The type of monster at a particular location is randomized.

Game Play

While the game is progressing, display the current health and the amount of collected gold. While the game is progressing, display each time the hero strikes a monster, each time the hero adds to his gold collection, and each time a monster strikes the hero.

Game Over

The game ends when the hero has 0 health points. Display "you lose!" or similar text and do not allow the hero any further motion.

The game ends when all gold has been picked up. Display "you win!" or similar text and do not allow the hero any further motion.

Extras

Generous extra credit will be given. Suggestions:

Grade based on

Satisfying specs 50%
Nice "look' to world and hero 10%
Elegance (no redundancy, etc) 30%
Readability 10%

Turn in