Haunted House – 4
10 Add Rooms, Inventory and Monsters
Extra Room and Items and Random Start function
This code extends/expands the scope of the game by adding a kitchen, a lamp, a knife, a key and a dragon.
These items are set in rooms using a random value (1, 2, 3) at the start, with corresponding changes to the room descriptions. You don’t die in the lounge anymore!
The only exit is to find the lamp (because it is dark!), find the knife, defeat the dragon to get the key and escape through the back door from the kitchen.
Other things you can add can include an inventory, rewards, health, hit points, etc.
Modify your code as shown in the coloured boxes:





Done? Show your teacher and get a stamp! Do the challenge.