getWalkableNeighbor

fun Locatable.getWalkableNeighbor(allowSelf: Boolean = true, diagonalTiles: Boolean = false, checkForWalls: Boolean = true, filter: (Tile) -> Boolean = { true }): Tile?

Returns: Tile nearest neighbor or self as which is walkable

Return

nearest walkable tile

Parameters

allowSelf

whether or not this method is allowed to return the Locatable from which it is called

diagonalTiles

whether or not diagonal tiles should be included

checkForWalls

if true, only neighbors will be returned that do not have a directional block-flag pointing towards the Locatable

filter

the filter through which potential neighbors have to go through before being returned

Checks the nearest walkable neighbor for Locatable. Also checks if there are walls blocking the neighbor from the Locatable