class

PointClickEngine::Scenes::NavigationManager

Inherits Reference < Object

Manages navigation and pathfinding for a scene

The NavigationManager handles all pathfinding-related functionality including:

  • Navigation grid setup and management
  • Pathfinding system initialization
  • Path calculation between points
  • Navigation debug visualization

Constructors

new(scene_width : Int32, scene_height : Int32)
Source

Instance methods

clear_navigation

Clears navigation data and resets system

Source
draw_navigation_debug(camera_offset : RL::Vector2)

Draws debug visualization for navigation system

Renders the navigation grid, showing walkable and blocked cells. Only draws when debug mode is enabled.

  • camera_offset : Camera offset for proper positioning
Source
export_navigation_data

Exports navigation data for external tools

Source
find_path(start_x : Int32, start_y : Int32, end_x : Int32, end_y : Int32) : Array(RL::Vector2) | Nil

Finds a path between two points using A* pathfinding

Returns an array of waypoints from start to end position, or nil if no path exists. Coordinates are in world space.

  • start_x : Starting X coordinate in world space
  • start_y : Starting Y coordinate in world space
  • end_x : Target X coordinate in world space
  • end_y : Target Y coordinate in world space

Returns: Array of Vector2 waypoints, or nil if no path found

Source
get_navigation_stats

Gets navigation statistics for debugging

Source
grid_cell_size

Navigation grid cell size (default: 10 pixels per cell)

Source
grid_cell_size=(grid_cell_size : Int32)

Navigation grid cell size (default: 10 pixels per cell)

Source
import_navigation_data(json_data : String)

Imports navigation data from external source

Source
initialized?

Checks if navigation system is properly initialized

Source
is_navigable?(x : Int32, y : Int32) : Bool

Checks if a specific position is navigable

  • x : X coordinate in world space
  • y : Y coordinate in world space

Returns: true if the position can be navigated to

Source
optimize_navigation

Optimizes navigation grid by removing unnecessary nodes

Source
pathfinder

A* pathfinder instance

Source
pathfinder=(pathfinder : Navigation::AStarAlgorithm | Nil)

A* pathfinder instance

Source
scene_height
Source
scene_height=(scene_height : Int32)
Source
scene_width

Scene dimensions for navigation setup

Source
scene_width=(scene_width : Int32)

Scene dimensions for navigation setup

Source
setup_navigation(walkable_area : WalkableArea | Nil = nil)

Sets up navigation grid and pathfinding system

Creates a navigation grid based on scene dimensions and initializes the A* pathfinder. Must be called before using pathfinding.

  • walkable_area : Optional walkable area for navigation constraints
Source
update_navigation(walkable_area : WalkableArea | Nil = nil)

Updates navigation grid based on scene changes

Recalculates walkable cells when scene layout changes. Should be called when walkable areas are modified.

  • walkable_area : Updated walkable area definition
Source