Text Game
Design a text game that uses the console to display the contents as well as to get user commands. Have the game describe the scene that the hero is in, list monsters present, display the command options, and act on the user's command; this should repeat until the end of the game is reached. It could look something like this:
When a movement action (a/s/d/w/r) is typed, a new description appears, as well as mention of a monster in the scene if any:
When 'f' is typed (as a command to fight) it subtracts a random amount of health from the monster depending on the range of damage your hero can do:
Requirements
- The following commands should be available: 'w' = move north, 'a' = move west, 's' = move south, 'd' = move east, 'f' = fight, 'r' = run, 'q' = quit game, 'i' = show info/stats, 'p' = drink healing potion, '?' = display these commands.
- Make it so the hero can deal damage to the monster and take damage and defeat it or die trying.
- Allow the hero to drink healing potions to restore health points.
- Allow the hero to level up when a monster is defeated, allowing your hero to do more damage so you can face stronger monsters that will need to be defeated to reach the end.
Hints
Store the map as a multidimensional array of Scene objects, where each object contains a description as well as Monster objects (if any) that are in the scene.