A grid of tiles with collision. Wraps coordinates when they fall out of bounds. Allows accessing tiles by index.
More...
|
void | Fill (Tile[,] tiles) |
| Uses a 2D Array of previously defined tile information to fill a tile map with collision data and other information. Must be called in order for the TileMap to function. More...
|
|
| TileMap (Texture2D texture, int cellSize, int margin=0, int spacing=0, int offset=0, float scale=1.0f) |
| Initializes a new instance of the T:MB2D.Tiles.TileMap class. Seperates the texture into a series of regions. More...
|
|
Rectangle | GetTile (int id) |
| Retrieves the bounding rectangle of a tile texture from the tilemap More...
|
|
void | Draw (SpriteBatch spriteBatch) |
| Draws the tile map to the specified SpriteBatch, wrapping the rendering when the camera reaches the bounds of the map. More...
|
|
void | HandleWrapping (Movement movement) |
| Handles wrapping an entity around the map if their movement falls out of bounds - gives the illusion of an infinitely looping map. More...
|
|
A grid of tiles with collision. Wraps coordinates when they fall out of bounds. Allows accessing tiles by index.
§ TileMap()
MB2D.Tiles.TileMap.TileMap |
( |
Texture2D |
texture, |
|
|
int |
cellSize, |
|
|
int |
margin = 0 , |
|
|
int |
spacing = 0 , |
|
|
int |
offset = 0 , |
|
|
float |
scale = 1.0f |
|
) |
| |
|
inline |
Initializes a new instance of the T:MB2D.Tiles.TileMap class. Seperates the texture into a series of regions.
- Parameters
-
texture | Texture to use in the texture atlas. |
cellSize | The size of each cell in the texture atlas. |
margin | Margin to apply to each rendered tile. |
spacing | Spacing to apply to each rendered tile. |
offset | Offset to apply to the x and y coordinates of each tile when rendering. |
scale | Scale vector to apply to each cell when rendering. |
§ Draw()
void MB2D.Tiles.TileMap.Draw |
( |
SpriteBatch |
spriteBatch | ) |
|
|
inline |
Draws the tile map to the specified SpriteBatch, wrapping the rendering when the camera reaches the bounds of the map.
- Parameters
-
spriteBatch | Sprite batch to draw to. |
§ Fill()
void MB2D.Tiles.TileMap.Fill |
( |
Tile |
tiles[,] | ) |
|
|
inline |
Uses a 2D Array of previously defined tile information to fill a tile map with collision data and other information. Must be called in order for the TileMap to function.
- Parameters
-
§ GetTile()
Rectangle MB2D.Tiles.TileMap.GetTile |
( |
int |
id | ) |
|
|
inline |
Retrieves the bounding rectangle of a tile texture from the tilemap
- Returns
- The tile ID's bounding rectangle.
- Parameters
-
§ HandleWrapping()
void MB2D.Tiles.TileMap.HandleWrapping |
( |
Movement |
movement | ) |
|
|
inline |
Handles wrapping an entity around the map if their movement falls out of bounds - gives the illusion of an infinitely looping map.
- Parameters
-
movement | Movement component to operate on. |
§ MapSize
Point MB2D.Tiles.TileMap.MapSize |
|
get |
Gets the size of the map.
The size of the map.
§ Texture
Texture2D MB2D.Tiles.TileMap.Texture |
|
get |
Gets the texture atlases undivided texture.
The texture.
§ this[int x, int y]
Tile MB2D.Tiles.TileMap.this[int x, int y] |
|
get |
Gets the T:MB2D.Tiles.Tile at the specified x y.
- Parameters
-
x | The x coordinate. |
y | The y coordinate. |
§ TileSize
Point MB2D.Tiles.TileMap.TileSize |
|
get |
Gets the size of each tile in the world.
The size of the tile.
The documentation for this class was generated from the following file:
- MB2D/src/Tiles/TileMap.cs