1) Create a class called Monster, with attribute name. You can have other enum variables too like :
public enum MonsterType { GOBLIN, ZOMBIE, GHOST };
public MonsterType type;
Feel free to create other enum variables ( if you feel you need more )
2) Create classes Goblin, Zombie, and Ghost which extends the Monster Class. Can have attributes int x, int y.
3) Create Dungeon which is a (10x10) array of Tiles.
4) A Tile has a 1-D array of Monsters, which starts out empty.
5) The Dungeon class should have methods
addMonster(Monster, x, y);
deleteMonsters(x,y); //deletes all monster in x,y
toString();// prints out the dungeon, and its inhabitants
You can add other functions if you want to ( according to need )
6) The Monsters should all have:
moveNorth(); //moves north one
moveSouth();
moveEast();
moveWest();
except that:
the goblin will continue moving as long as there is someone else in its destination spot
the zombie kills (deletes) everyone else in its destination spot.
if a ghost lands in a Tile with another ghost, if keeps moving to the next spot.
Tuesday, October 26, 2010
LabTest#2 -- Walk through GRID Dungeons
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment