Question: C++ TEXT-BASED ADVENTURE GAME: 1 The Lab The source code for the game we developed in class is included with this lab. In this lab
C++ TEXT-BASED ADVENTURE GAME:
1 The Lab The source code for the game we developed in class is included with this lab. In this lab you will add items and doors, make some simple additions to the existing code and, of course, any other features you would like. If youve never played a text-based adventure game, you should try one before working on this lab. Well call it research :) 2 Listing Exits Modify the room description method so that it includes a list of all of the exits. See the example output at the end of this lab description for examples. 3 Items Commands: take, drop, look Your game must include items. A room may contain items and the player may take or drop these items. The list of visible items in a room should be displayed with the room description. Items may be hidden. Finding a hidden item in a room requires that the user look at an object in the room (normally part of the room description). When the player discovers an item, you must tell them and update the list of visible items in the room to reflect this item (so they dont have to look next time). Items must (typically) have a purpose in the game. Some actions require the player to have an item to complete. Examples of kinds of items you can include: tools required to complete actions (need shovel to dig) keys required to open locked doors food can eat to give the character abilities... Items are identified by keywords. So, for example, a golden key would be identified by the keyword key. Some items may have multiple keywords. These keywords are used to pick which item is to be taken or dropped (drop key). 4 Doors
Minimum commands: open, close, lock, unlock
Exits can have doors which may be opened or closed. Some doors may be lockable. Lockable doors may be either locked or unlocked. The player must have the appropriate item to lock or unlock a lockable door. If a player tries to go through an exit that is blocked by an unlock door, automatically open it for them. Otherwise, they must have the appropriate key and unlock the door before they can go through the exit. 5 Objective Your game must have one or more objectives (room they have to reach, item they have to collect etc). The player should be rewarded by boundless fanfare when they complete an objective (or just tell them Good Job). 6 Inheritance Your game must make use of inheritance and polymorphism in a way that enhances its design. Examples include multiple item classes that act differently when used. Multiple door classes (lockable, not lockable etc). 7 Sample Room Boring Room You are in a warm, damp room. A chilling draft is coming from the north. There is a large shelf on the south wall of the room. In the room you see: a shovel There are exits north and west. The north exit is blocked by a large wooden door. Command: go north You cant go north because the large wooden door is locked. ------------------- Command: take shovel You have a shovel. ------------------- Command: dig You use a shovel to dig in the loose dirt and find a gem. ------------------- Command: look shelf You discovered a gold key. ------------------- Command: look ------------------- Boring Room You are in a warm, damp room. A chilling draft is coming from the north. There is a large shelf on the south wall of the room. In the middle of the room there is some loose dirt. In the room you see: a gold key There are exits north and west. The north exit is blocked by a large wooden door. Command: take key You have a gold key ------------------- Command: unlock wooden door You used a gold key to unlock the large wooden door. ------------------- Command: go north ------------------- Boring Room You are in a warm, damp room. A chilling draft is coming from the north. There is a large shelf on the south wall of the room. In the middle of the room there is some loose dirt. In the room you see: a gold key There are exits north and west. The north exit is blocked by a large wooden door. Command: go north You opened the large wooden door. ------------------- Room that is north of the Boring Room ...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
