PointClickEngine::Navigation::NavigationGrid
Inherits Reference < Object
Grid-based navigation mesh for pathfinding
The NavigationGrid provides a grid-based representation of walkable areas in the game world. It handles coordinate conversion between world space and grid space, and manages walkable/non-walkable cell states.
Constructors
new(width : Int32, height : Int32, cell_size : Int32 = PointClickEngine::Core::GameConstants::DEFAULT_NAVIGATION_CELL_SIZE)
SourceInstance methods
cell_size
Sourcecell_size=(cell_size : Int32)
Sourceget_walkable_neighbors(grid_x : Int32, grid_y : Int32, allow_diagonal : Bool = true) : Array(Tuple(Int32, Int32))
Gets all walkable cells adjacent to a given position
grid_to_world(grid_x : Int32, grid_y : Int32) : Tuple(Float32, Float32)
Converts grid coordinates to world coordinates (center of cell)
height
Sourceheight=(height : Int32)
Sourcein_bounds?(world_x : Float32, world_y : Float32) : Bool
Checks if world coordinates are within grid bounds
set_circle_walkable(center_x : Float32, center_y : Float32, radius : Float32, walkable : Bool)
Marks a circular area as walkable or not walkable
set_rect_walkable(x : Int32, y : Int32, width : Int32, height : Int32, walkable : Bool)
Marks a rectangular area as walkable or not walkable
set_walkable(x : Int32, y : Int32, walkable : Bool)
Sets walkable state for a specific grid cell
valid_grid_coords?(grid_x : Int32, grid_y : Int32) : Bool
Checks if grid coordinates are valid
world_to_grid(world_x : Float32, world_y : Float32) : Tuple(Int32, Int32)
Converts world coordinates to grid coordinates