You will be a creating a “treasure hunt” game where a player explores avirtual map looking for treasure.
1.
[200 pts]
You will be a creating a âtreasure huntâ game where a player explores a
virtual map looking for treasure. This will be a text based game, so the terminal will
be utilized for describing the playerâs surrounding and exploration options. This will
be a randomly generated game, where each play will have a random map/world for
the player to explore. The goal of the game is for the player to find the hidden ruins
and discover the treasure before running out of energy.
The core of this game is exploring a map with different types of âLandsâ. There will be
four different kinds of lands to explore, such as forests, deserts, orchards, lakes, and
ruins. The player will have a set x,y position within the map, and each turn will be
given the option to explore north, south, east, or west.
To start with a map of a certain dimension will be constructed (default dimension
is
10
Ã
10
). Player will be placed in the middle of map (default is at
5
Ã
5
) with en-
ergy level set to 5 . The user will be provided with the description on what is seen in
NORTH, SOUTH, EAST, and WEST direction. The sample descriptions are as follows:
You see ,
a tropical dense forest to the north ,
an orchard filled with apples to the south ,
a water body to quench your thirst to the west ,
an arid hot desert to the east.
Then the user will make a choice on which direction to move. Depending on the move
the user will either increase the energy or decrease the energy and an outcome will
be described. The energy level and description are as follows:
Land
Outcome
Energy Level
Desert
You walk through the hot and dry desert Decrements by 2
Forest
You trek through the dense forest
Decrements by 1
Orchard
You eat an apple in the orchard
Increment by 2
Lake
You are hydrated
Increment by 1
After each turn, a banner is displayed which details the current energy level of the
user. The game ends when the user runs out of the energy or finds the treasure.
2
2.
Implementation
To implement you will use the following files:
â¢
Player
:
Player.h
consists of the definition of the Player class and the implemen-
tation is done in
Player.cpp
â¢
Land
:
Land.h
consists of an Abstract class (pure virtual function) and Derived
class for Desert, Forest, Orchard, Lake, and Ruins.
â¢
gameEngine.cpp
: Creates the map using a random number generator, and con-
trols the game through a Player object
â¢
treasure
:
treasure.h
is the game header which includes all the necessary header.
treasure.cpp
creates the Player object and calls the
gameEngine
function
Description:
⢠Player class will contain (minimal)
â
the current x and y position, energy level, treasure found or not. Write acces-
sors and mutators to access these data members
â
the map dimension. This should be a static private member and add a public
static function to access the data
â
the player movement function. These function (one for each direction North,
South, East, South) will increment or decrement depending on player move-
ment. Make sure to check the boundaries else will result in segmentation
fault
⢠Land class will contain
â
An abstract class with two pure virtual function. One for the description and
the other for player visit
â
derived classes (derived form Land) for Forest, Orchard, Desert, Lake, and
Ruins. In each derived class the description and player visit function is re-
defined. The player visit function requires Player object to increment and
decrement the energy level
⢠GameEngine will contain
â
a two dimensional map of all the Land. Use the upcasting technique to create
a variable (Remember Land is an Abstract class you CANNOT have a valued
object of Land)
â
map is defined using random variable generator. (Use
random
library and
NOT time rand() function)
â
a loop for game runtime which displays the description, gets the user input,
and displays the outcome until the energy is exhausted, or user finds the
treasure, or user press Q (Q for QUIT)
3
3 Deliverable
There is no demo for this lab. Instead you turn in the following:
1. Upload all the cpp and h file (do not upload the makefile)
2. Take a screenshot of your output showing at least two turns and upload it to Canvas
(in PNG
Get Help With a similar task to - You will be a creating a “treasure hunt” game where a player explores avirtual map looking for treasure.
Related Questions
Tutlance Experts offer help in a wide range of topics. Here are some of our top services:
- Math homework help
- Nursing homework help
- Statistics homework help
- Nursing coursework help
- Capstone project writing services
- Essay writers for hire
- Case study writing help
- Buy college papers online
- Buy college research papers
- College homework help
- Professional resume writing services
- Programming homework help
- Coursework writing help
- Term paper writing help
- Biology homework help
- Do my physics homework
- Dissertation data analysis help
- PhD Dissertation writing services
- Chemistry homework help
Post your project now for free and watch professional experts outbid each other in just a few minutes.