Embed presentation
Download to read offline
![So I have 3 enums named land_type, entity, tile as shown:
enum land_type {
GRASS,
WATER,
PATH_START,
PATH_END,
PATH_UP,
PATH_RIGHT,
PATH_DOWN,
PATH_LEFT,
TELEPORTER
};
enum entity {
EMPTY,
ENEMY,
BASIC_TOWER,
POWER_TOWER,
FORTIFIED_TOWER,
};
and I have created a struct named:
struct tile {
enum land_type land;
enum entity entity;
int n_enemies;
}; // which consists of all the enums.
I have also created something called map[SP1][SP2], SP1 = Row component of starting point
and SP2 is column component of starting point. both of type ints. Similarly, map[EP1][EP2] is
the end points. How do I assign these Starting points and end points into the enum
PATH_START and PATH_END respectively?](https://image.slidesharecdn.com/soihave3enumsnamedlandtypeentitytileasshownenumlan-230331133644-58323358/75/So-I-have-3-enums-named-land_type-entity-tile-as-shown-enum-lan-pdf-1-2048.jpg)
The document describes 3 enums - land_type, entity, and tile - that define different land and entity types in a game. It also describes a tile struct containing fields for the land type, entity, and number of enemies. Finally, it introduces map arrays with starting and ending point indices and asks how to assign the starting and ending points to the PATH_START and PATH_END enum values respectively within the map.
![So I have 3 enums named land_type, entity, tile as shown:
enum land_type {
GRASS,
WATER,
PATH_START,
PATH_END,
PATH_UP,
PATH_RIGHT,
PATH_DOWN,
PATH_LEFT,
TELEPORTER
};
enum entity {
EMPTY,
ENEMY,
BASIC_TOWER,
POWER_TOWER,
FORTIFIED_TOWER,
};
and I have created a struct named:
struct tile {
enum land_type land;
enum entity entity;
int n_enemies;
}; // which consists of all the enums.
I have also created something called map[SP1][SP2], SP1 = Row component of starting point
and SP2 is column component of starting point. both of type ints. Similarly, map[EP1][EP2] is
the end points. How do I assign these Starting points and end points into the enum
PATH_START and PATH_END respectively?](https://image.slidesharecdn.com/soihave3enumsnamedlandtypeentitytileasshownenumlan-230331133644-58323358/75/So-I-have-3-enums-named-land_type-entity-tile-as-shown-enum-lan-pdf-1-2048.jpg)