Question: I ' m writing call functions for a C + + program , please follow the following requirements to complete these four call functions on

I'm writing call functions for aC++program, please follow the following requirements to complete these four call functions on the basis of the existing code, thank you very much.
Actually, the composition of this txt file is like this, the first line will have two numbers m and nto tell you that this map is a square ofmn
The next line starts with the content of the map itself, and when the content of the map ends, the last line is the letters wasd in a certain order, telling you that the ship F will move one block at a time in the order of movement ofup(w),down (s),left (a),and right (d).
In this function, you need to load the map from a text file called map.txt and initialize variables ship and boss. Notably, map could be modified here.
A map text file should contains a matrix of characters of size rows cols. The character in each cell should be either .,F,E,RorB.
F stands for your spaceship's starting position.
E stands for the enemy position, which will deduct your game score 10when you hit it.When your ship leaves the E sector, it will become anX zone, indicating that the enemy have been defeated. Itis denoted by the letter "X".
R stands for the resource position, which will increase your game score 20when you hit it.When your ship leaves the R sector, it will become anX zone, indicating that the resources have been exhausted. Itis denoted by the letter "X".
B stands for the boss position, which you must defeat it with enough points. When you hit the boss, the game will over.
.is a placeholder, which means there is nothing at that position.
An example map file of size 55should look like this
55
. R . E .
.. F ..
. B . R .
.... E
wasdss
Other codes are shown in the images
I ' m writing call functions for a C + + program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!