Class GridGroup
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.sprite.GridGroup
- All Implemented Interfaces:
Lifecycle
,Printable
,ComponentFinder
,EntityFinder
A component that groups 2D tiles together and aligns them in a grid pattern.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTile
(TileRenderer tile) Adds a tile to this grid based on the tile's current coordinate.addTile
(TilePrefab tilePrefab, int x, int y) addTile
(TilePrefab tilePrefab, Vector2i coordinate) coordinateToPosition
(int x, int y) coordinateToPosition
(Vector2i coordinate) getName()
getTile
(int x, int y) boolean
hasTile
(int x, int y) boolean
boolean
isHovering
(TileRenderer tile) boolean
isHovering
(Entity entity) void
positionToCoordinate
(float x, float y) positionToCoordinate
(Vector2f position) boolean
removeTile
(Vector2i coordinate) boolean
removeTile
(TileRenderer tile) boolean
removeTile
(Entity entity) Methods inherited from class dev.prozilla.pine.core.component.Component
equals, getCamera, getChildWithTag, getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildren, getEntity, getInput, getLogger, getParentWithTag, getRenderer, getTimer, getTracker, getTransform, getWindow, getWorld, hashCode, setActive, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
size
public int size -
coordinateToTile
-
hoveringTile
-
-
Constructor Details
-
GridGroup
public GridGroup(int size)
-
-
Method Details
-
getName
-
addTile
-
addTile
-
addTile
-
addTile
-
addTile
Adds a tile to this grid based on the tile's current coordinate.- Parameters:
tile
- Tile to add to this grid- Throws:
IllegalStateException
- If there is already a tile in this grid with the same coordinateNullPointerException
-
removeTile
-
removeTile
-
removeTile
-
hasTile
public boolean hasTile(int x, int y) -
hasTile
-
getTile
-
getTile
-
moveTile
-
isHovering
-
isHovering
-
positionToCoordinate
-
positionToCoordinate
-
coordinateToPosition
-
coordinateToPosition
-