Question: C + + PLEASE Assignment 5 C: Level Map Creator. There are a variety of ways that game developers store their level layouts. One simple

C++ PLEASE Assignment 5C: Level Map Creator. There are a variety of ways that game developers store their level layouts. One simple method is to associate level elements with certain symbols, and then storing them in a 2D grid inside a text file. We will use our knowledge of 2D arrays to create a very simple Level Map Creator tool. The program should prompt the user to enter a width and height for the level. Then it should initialize a 2D array and fill every element with the *** symbol. Afterwards, the user should be given the following options via a menu: 1. Clear Level 2. Add Platform 3. Add Item Re-initialize the 2D array and fill every element with the *** symbol. Prompt the user to enter a starting point and length for the horizontal platform. Replace those elements in the 2D array with the "=" symbol. If the length is longer than the number of columns (or out of bounds), notify the user that this is not possible. Prompt the user to enter a column and row index. Replace that element in the 2D array with the "0" symbol. If the column and row index in outside the bounds of the array, notify the user that this is not possible. End the program 4. Quit: After completing the task, print the modified 2D array, If anything other than Quit is selected, display the menu again. Otherwise, tell the player "Good byel and stop, Hints: Since we're using a 2D array to represent the level map, we'll use its indexes for our level coordinates. 0,0 will be the top-left corner of the map, and will correspond to array[0][0] Sample Output : [FYE Level Map Creator) Enter a level map width: 20 Enter a level map height: 6
Hello, I've done the question above, but am running into an error in case 2 of my switch statement. Could you tell me how to relsolve the issue in C++?
My code:
{
int xi?? defines x coordinate
int yi?? defines y coordinate
string player ="P"; //deines the symbol for case 3
string platform ="="; //deines the platform symbol
int choice; //players choice of action
string symbol ="-";
int width;//defines user inouted width
int height; //defines user inputed height
cout "[FYE Level Map Creator]??
;
cout "Enter a level map width: ";
cin width;
cout "Enter a level map height: ";
cin height;
string** array = new string *[height]; //creates a dynamic 2D array
for (int i=0;i height; i++
array[i]= new string[width];
for (int j=ij width; j++){
array[i][j]= symbol;
}
do {
for (int i=0;i height; i++ prints the current arry
for (int j=0;j width; j++){
cout array[i][j];
}
cout ?
;
}
cout "Options ??
;
cin choice;
switch (choice){
case 1: //creates a code silar to above and reenters the sybol for each part
for (int i=0;i height; i++){
array[i]= new string[width];
for (int j=0ij width; j++){
array[i][j]= symbol;
}
}case 2:
int length; //defines length of platform
//ask user for input info
cout "
[Add Platform]
";
cout "Enter X Coordinate: ";
cin x;
cout "Enter Y Coordinate: ";
cin y;
cout "Enter a Length: ";
cin length;
//statements for what this input can be
if (x> width ||y> height){
cout "This is not a valid location!
";
break;
}
else if (length > width){
cout "This platform won't fit in the level!
";
}
break;
//assign new values to array
for (int z=0;z length; z++){
array [x][y]= platform;
}
y++;
break;
case 3 :
cout "[Add Item]??
;
cout "Enter x Coordinate: ";
cin x;
cout "Enter Y Coordinate: ";
cin y;
array[y][x]= player;
}
} while (choice !=4);
cout "
Goodbye!";
}
 C++ PLEASE Assignment 5C: Level Map Creator. There are a variety

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 Databases Questions!