This class is used to generate GridTile tiles to form a grid. The class can be cleaned with the 'clean' method
- Author
- Ramses Di Perna
◆ Grid()
com.mygdx.game.level.Grid.Grid |
( |
int |
gridWidth, |
|
|
int |
gridHeight, |
|
|
int |
tileAmountX, |
|
|
int |
tileAmountY |
|
) |
| |
By calling the constructor the Grid will be generated with the given information.
- Parameters
-
gridWidth | is the total width of the grid in pixels |
gridHeight | is the total height of the grid in pixels |
tileAmountX | is the amount of tiles which should be generated in the X axis. The width of the tile will be the width of the grid / tileAmountX |
tileAmountY | is the amount of tiles which should be generated in the Y axis. The height of the tile will be the height of the grid / tileAmountY |
◆ clean()
void com.mygdx.game.level.Grid.clean |
( |
| ) |
|
To clean the class's references. After this method, all references of this class should be nulled and the class should not be used. This method makes the class unusable for future use.
◆ debugRender()
Renders the grid for debugging purposes on the screen.
- Parameters
-
renderComponents | to render the grid with. |
◆ getAllTiles()
ArrayList<ArrayList<GridTile> > com.mygdx.game.level.Grid.getAllTiles |
( |
| ) |
|
Returns all tiles created by this grid.
- Returns
- All GridTile objects made by this grid.
◆ getAllTilesInYRow()
ArrayList<GridTile> com.mygdx.game.level.Grid.getAllTilesInYRow |
( |
int |
yRow | ) |
|
Returns all tiles created by this grid.
- Returns
- All GridTile objects made by this grid.
◆ getGridHeight()
float com.mygdx.game.level.Grid.getGridHeight |
( |
| ) |
|
The height of the entire grid given in the constructor
- Returns
- The height of the grid.
◆ getGridWidth()
float com.mygdx.game.level.Grid.getGridWidth |
( |
| ) |
|
The width of the entire grid given in the constructor
- Returns
- The width of the grid.
◆ getTile()
GridTile com.mygdx.game.level.Grid.getTile |
( |
int |
gridXPos, |
|
|
int |
gridYPos |
|
) |
| |
Gets the tile with the same x and y index.
- Parameters
-
gridXPos | is the index of the tile's x axis |
gridYPos | is the index of the tile's y axis |
- Returns
- The tile on the given indexes. If the indexes are out of bounds, this will return 'null'
◆ getTileAmountX()
int com.mygdx.game.level.Grid.getTileAmountX |
( |
| ) |
|
Gets the amount of tiles in the x axis given in the constructor.
- Returns
- The amount of tiles in the x axis
◆ getTileAmountY()
int com.mygdx.game.level.Grid.getTileAmountY |
( |
| ) |
|
Gets the amount of tiles in the y axis given in the constructor
- Returns
- The amount of tiles in the y axis
◆ getTileHeight()
float com.mygdx.game.level.Grid.getTileHeight |
( |
| ) |
|
Gets the tile height (The height of the tile will be the height of the grid / tileAmountY)
- Returns
- The height of a tile in pixels
◆ getTileWidth()
float com.mygdx.game.level.Grid.getTileWidth |
( |
| ) |
|
Gets the tile width (The width of the tile will be the width of the grid / tileAmountX)
- Returns
- The width of a tile in pixels
◆ getTileWorldPosition()
Vector2 com.mygdx.game.level.Grid.getTileWorldPosition |
( |
int |
gridXPos, |
|
|
int |
gridYPos |
|
) |
| |
Returns the world position of tile location given.
- Parameters
-
gridXPos | is the index of the tile's x axis |
gridYPos | is the index of the tile's y axis |
- Returns
- The world position of the given tile (The left down corner of it)
The documentation for this class was generated from the following file:
- C:/Users/RamsesPC/Documents/LibGDXGames/PvB/core/src/com/mygdx/game/level/Grid.java