Static class representing the map of the game world. Map contains information about which tiles are accessible and which are not. It also contains information about the height of the tiles. It does not contain any information about the entities in the world. For that refer to GameWorld.
More...
#include <Map.hpp>
|
| static void | loadMap () |
| | Loads the map information from generated assets. Currently loads the access map and height map information. More...
|
| |
| static std::vector< std::pair< int, int > > | findPath (Coordinates start, Coordinates end) |
| | Finds a path from start to end. More...
|
| |
| static std::vector< std::pair< int, int > > | findPathToRange (Coordinates start, Coordinates end, int range) |
| | Finds a path to some locations range. Can be used, for example, if the attack target is not in range, we can find a path to a location that is in range. More...
|
| |
| static std::optional< int > | getHeight (int x, int y) |
| | Gives the height for the given (x, y) coordinates. More...
|
| |
| static const std::vector< std::vector< uint8_t > > & | getAccessMap () |
| | Get the access map. More...
|
| |
| static Coordinates | getRandomCoordinates (const SpawnCoordinateBounds &coordinateBounds) |
| | Gets a random coordinate within the given bounds. More...
|
| |
| static Coordinates | getRandomNeighbour (Coordinates coordinates, const SpawnCoordinateBounds &coordinateBounds) |
| | Gets a random neighbour of the given coordinates. More...
|
| |
|
| static std::vector< std::vector< uint8_t > > | accessMapM = {} |
| |
| static std::vector< std::vector< int > > | heightMapM = {} |
| |
Static class representing the map of the game world. Map contains information about which tiles are accessible and which are not. It also contains information about the height of the tiles. It does not contain any information about the entities in the world. For that refer to GameWorld.
◆ findPath()
Finds a path from start to end.
- Parameters
-
| start | Starting coordinates |
| end | Ending coordinates |
- Returns
- Vector of coordinates (x,y) that form the path. Empty vector if no path found.
◆ findPathToRange()
Finds a path to some locations range. Can be used, for example, if the attack target is not in range, we can find a path to a location that is in range.
- Parameters
-
| start | Starting coordinates |
| end | Ending coordinates |
| range | Range in tiles |
- Returns
- Vector of coordinates (x,y) that form the path. Empty vector if no path found.
◆ getAccessMap()
| const std::vector< std::vector< uint8_t > > & Map::getAccessMap |
( |
| ) |
|
|
static |
Get the access map.
- Returns
- access map
◆ getHeight()
| std::optional< int > Map::getHeight |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
static |
Gives the height for the given (x, y) coordinates.
- Parameters
-
| x | X-coordinate |
| y | Y-coordinate |
- Returns
- Height of the given coordinates wrapped in optional.
◆ getRandomCoordinates()
Gets a random coordinate within the given bounds.
- Parameters
-
- Returns
- Coordinates
◆ getRandomNeighbour()
Gets a random neighbour of the given coordinates.
- Parameters
-
| coordinates | |
| coordinateBounds | Bounds for the coordinates |
- Returns
- Coordinates (Returns the given coordinates if no neighbours found/accessible)
◆ loadMap()
Loads the map information from generated assets. Currently loads the access map and height map information.
- Note
- Call this before using any other methods of this class.
- Returns
- Nothing
◆ accessMapM
| std::vector<std::vector<uint8_t> > Map::accessMapM = {} |
|
inlinestaticprivate |
◆ heightMapM
| std::vector<std::vector<int> > Map::heightMapM = {} |
|
inlinestaticprivate |
The documentation for this class was generated from the following files: