Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Stage 1 . 2 - Validate Player Spawn Now that you got the player onto the map, lets restrict where they could spawn at .
Stage Validate Player Spawn
Now that you got the player onto the map, lets restrict where they could spawn at It would
make more sense if they start from the edge of the map, so now the player's starting position
will need to be error checked so that it is within the spawn boundary.
HINT The span boundary are the edge tiles of the map ie tiles whose row must either be
or
or
col
must either be
or
or MAXCOL
must either be
Remember that array indicies start at
Here is a diagram with the spawn boundary highlighted in blue. Stage
Stage Spawn player
To ease you into this assignment, your first task is to spawn the player onto the map!
Currently, the provided starter code creates a D array of
and initialises
them with the initialisemap function that is included.
Your program will need to scan in the player's starting position. This will be given as a pair of
integers which denotes the row and column in that order You will need to then use the
provided
function to print the map with the player.
HINT Unsure how to call the
function? Here is an example that you can copy
to your main function.
Notice how we only need to provide the
variable, no square brackets are required!
This will print your current map with the player spawning at How could you modify this
to use the position that you scanned in
Here is a diagram of the map where the player is spawned at The player is represented
on the map as Assignment Structure
This assignment will test your ability to create, use and manipulate D arrays and structs to solve
problems. This will be done through the ingame map that has been implemented as a D array of
tiles. Each of these tiles are represented by a
which is outlined below:
struct tile
Purpose:
To store information about the tiles of the map.
Contains:
enum tiletype type
The type of the map tile.
All tile types are found in the enum tiletype definition.
struct flower flower
Represents the enemy flower at this location if one exists
struct flower
Purpose:
To store information about a particular enemy flower.
Contains:
enum flowerstate state
Represents the state that the enemy flower is in
The provided enums are quite extensive. Definitions of each are provided below:
enum tiletype
Purpose:
Represent the possible types of a tile.
Possible values:
Represents an empty space.Assumptions Restrictions Clarifications
The row and column input will always be integer values.
A valid position will eventually be scanned in
Examples
Example : One Invalid Position
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started