Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 6 B: Level Map Creator. There are a variety of ways that game developers store their level layouts. One simple method is to associate

Assignment 6B: 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 lists 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 list and fill every element with the _ symbol. Afterwards, the user should be
given the following options via a menu:
1. Clear Level Re-initialize the 2D list and fill every element with the _ symbol.
2. Add Platform Prompt the user to enter a starting point and length for the
horizontal platform. Replace those elements in the 2D list 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.
3. Add Item Prompt the user to enter a column and row index. Replace that
element in the 2D list with the P symbol. If the column and row
index in outside the bounds of the list, notify the user that this is not
possible.
4. Quit: End the program
After completing the task, print the modified 2D list, If anything other than Quit is
selected, display the menu again. Otherwise, tell the player Good bye! and stop.
Hints: Since were using a 2D list to represent the level map, well use its indexes for our
level coordinates. 0,0 will be the top-left corner of the map, and will correspond to list[0]
[0].
Sample Output #1:
[FYE Level Map Creator]
Enter a level map width: 20
Enter a level map height: 6
____________________
____________________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 2
[Add Platform]
Enter X Coordinate: 1
Enter Y Coordinate: 1
Enter Length: 5
____________________
_=====______________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 3
[Add Item]
Enter X Coordinate: 30
Enter Y Coordinate: 30
This is not a valid location!
____________________
_=====______________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 3
[Add Item]
Enter X Coordinate: 3
Enter Y Coordinate: 0
___P________________
_=====______________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 2
[Add Platform]
Enter X Coordinate: 3
Enter Y Coordinate: 1
Enter Length: 29
This platform wont fit in the level!
___P________________
_=====______________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 1
[Clear Level]
____________________
____________________
____________________
____________________
____________________
____________________
Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 4
____________________
____________________
____________________
____________________
____________________
____________________
Goodbye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Why is it important to analyze your spending habits?

Answered: 1 week ago

Question

What information remains to be obtained?

Answered: 1 week ago

Question

How reliable is this existing information?

Answered: 1 week ago

Question

How appropriate would it be to conduct additional research?

Answered: 1 week ago