Starting from:

$30

CS211-Project 7 Dungeon Crawler Solved

In this project you will be creating a dungeon crawler game. In this program you will have a player character that will move from room to room in the dungeon collecting chests and accumulating gold. The objective is to have the character accumulate the maximum amount of gold and exit the dungeon. Once you exit a room you cannot return to said room.

 

Controls 
 

You will have a character that moves using the ‘w’,’a’,’s’, and ’d’ keys. You will go through the dungeon collecting chests until you reach an exit or hit the ‘q’ button to quit the game.  

 

Class Break Down
 

For this assignment you will be writing a C++ Program that will contain the following classes:

1.      Tile Class

a.      Chest Class

b.      Door Class

c.      Wall Class

2.      Room Class

3.      Player Class

 

For the purposes of this assignment the classes and interfaces are defined below, along with the basic interactions.

1.      The Tile Class is a class that contains abstract methods, the purpose of this class is to create a common access class that the player can interact with, without knowing whether they are dealing with a Wall, a Tile, a Chest or a Door. The tile itself will be the parent.

 

a.      The generic tile is the floor that the player stands on. This role is not interactive aside from the player's ability to stand on it.

b.      The wall tile is a barrier, when the player reaches the edge of the M*N matrix (rows 0 and M, columns 0 and N) the player will be placed back on the tile from the previous move.

c.      The chest tile is a tile that when found will contain a number. This number will be added to the score.

d.      There will be a defined number of doors.

e.      Inheritance will be required to be used for these tiles, as the M*N matrix will only be defined as a Tiles matrix

f.       It will also have a data member for if the player is on that tile

 

 

 

 

2.      The Room will contain a N*M matrix of Tiles (This is a dynamic matrix similar to Project 3)

 

a. The N*M matrix will have its size determined by the input file and have a border added to it (1 space wide, see earlier maze project) b. This class will contain N*M Matrix of Tiles

 

i.            The matrix will contain a number of doors that will be placed according to the input

file

ii.          The Matrix will contain some number of chests as defined in the input file

 

3.      The User interface will process the commands given by the User and will interact with the rooms, determining what actions will be taken and keeping track of the player’s current location in the Dungeon (filename) and in the room (x,y coordinates).

 

a.      The command F: used to find a path to a door using DFS

b.      The WASD keys: used to send the player to a new tile adjacent to current tile.

c.      The H key: used to remind the player of the commands and what characters represent which tile types.       

d.      The G key: used to print the score

 

4.         The Player Class will contain the following items

 

a.      A value in which to store the amount of gold collected

b.      The number of tiles visited

c.      Current x,y location

 

Program Commands 
 

You have to read the user’s input keys and execute proper actions. Project 6 should help you set up the process of reading user input from standard input.

 


Exit the program  

Your Player will move to the neighboring tile above. If the current position is (x , y) after reading “W” key input, you should move the player to neighboring tile at position (x, y-1). 

Your Player will move to the neighboring left tile. If the current position is (x , y) after reading “A” key input, you should move the player to neighboring tile at position (x-1, y). 

Your Player will move to the neighboring tile below. If the current position is (x , y) after reading “S” key input, you should move the player to neighboring tile at position (x, y+1). 

Your Player will move to the neighboring right tile. If the current position is (x , y) after reading “D” key input, you should move the player to neighboring tile at position (x+1, y). 

Print a list of all available commands 

Print Player’s score 

Find a path to a door using DFS and print the path 


(Optional) 
Find the Shortest path to the nearest door using BFS and print the path 
  

Program Input (your maze project will be helpful)
 

Your input file will be formatted in the following format:

X Y (size X by Y)

S X Y (Start location of person)

O X Y (List of obstacles)

C  X Y Point_Value (chests)

D  X Y “filename.txt”(Doors see project 6)   

E   X Y (Dungeon Exit, will only be in 1 file)

 

You will be required to write a .txt which contains your own custom room design. It will be called “Room5.txt” This room will also contain your dungeon’s exit.

 

Display/Output 

 

A sample room CAN look like this (we are not binding you to these ascii characters, but please make sure it’s obvious what everything is:

********************

*P                       *

*****************   *

*                                        *

*                                        ****************

*                                        *             *

*                                        C  *    * D     *

********************

 

At the end of the game you will print out the number of gold coins collected.

   

Multiple Source Code Files
 

Your program is to be written using at least two source code files. One of the source file files is to contain the main function of the program named in a file using your net-id and Program name, like:

net-idProj7.cpp

You must have at least one file for each of the classes listed above and 1 for the file that will contain your main.

You will also be required to create your own text file for a room. This should be called “Room5.txt”  

 

The above implies that you will need to write any appropriate .h file(s) and a makefile.

 

Coding Style
 

Don’t forget to use good coding style when writing your program.  Good coding style makes your program easier to be read by other people as the compiler ignores these parts/differences in your code.  

Elements of good code style include (but may not be limited to):

•Meaningful variable names

•Use of functions/methods

•Proper indentation

•Use of blank lines between code sections

•In-line comments

•  Function/method header comments

•  File header comments

The Code Review Checklist also hints at other elements of good coding style.

More products