Package io.github.srcimon.screwbox.core
Class Grid
java.lang.Object
io.github.srcimon.screwbox.core.Grid
- All Implemented Interfaces:
Serializable
A
Grid
to raster your game world. The Grid
is a two
dimensional area with blocked and free Grid.Node
s that is aligned to the
game world.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarea()
void
block
(int x, int y) void
void
void
int
blockedNeighbors
(Grid.Node node) Returns a new instance without any blockedGrid.Node
s.void
void
int
double
gridSize()
int
height()
boolean
isBlocked
(int x, int y) boolean
boolean
isFree
(int x, int y) Retruns true if the given position is not blocked and inside theGrid
.boolean
nodeAt
(int x, int y) Returns theGrid.Node
at the given Position.int
nodes()
reachableNeighbors
(Grid.Node node) int
width()
worldPosition
(Grid.Node node)
-
Constructor Details
-
Grid
-
Grid
-
-
Method Details
-
clearedInstance
Returns a new instance without any blockedGrid.Node
s. -
area
-
nodeAt
-
isFree
public boolean isFree(int x, int y) Retruns true if the given position is not blocked and inside theGrid
. -
isFree
-
worldPosition
-
worldArea
-
toGrid
-
freeArea
-
freeAt
-
blockAt
-
block
-
block
public void block(int x, int y) -
blockArea
-
width
public int width() -
height
public int height() -
blockedNeighbors
-
neighbors
-
reachableNeighbors
-
nodes
-
nodeCount
public int nodeCount() -
blockedCount
public int blockedCount() -
freeCount
public int freeCount() -
backtrack
-
snap
-
isBlocked
public boolean isBlocked(int x, int y) -
isBlocked
-
gridSize
public double gridSize()
-