Validates movement rules and calculates movement costs
The MovementValidator handles validation of character movement
including diagonal movement rules, corner cutting prevention,
and movement cost calculations for pathfinding algorithms.
Constructors
for_grid_based
Creates validator for grid-based games
Sourcefor_point_and_click
Creates validator with optimal settings for point and click games
Sourcefor_strategy
Creates validator for strategy games
Sourcenew(allow_diagonal : Bool = true, prevent_corner_cutting : Bool = true, diagonal_cost : Float32 = PointClickEngine::Core::GameConstants::DIAGONAL_MOVEMENT_COST, orthogonal_cost : Float32 = PointClickEngine::Core::GameConstants::CARDINAL_MOVEMENT_COST)
SourceInstance methods
allow_diagonal=(allow_diagonal : Bool)
Sourcecalculate_move_cost(from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Float32
Calculates movement cost between two positions
Sourcecalculate_move_cost(from : Node, to : Node) : Float32
Calculates movement cost between nodes
Sourcecan_move?(grid : NavigationGrid, from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Bool
Validates if movement from one position to another is allowed
Sourcecan_move?(grid : NavigationGrid, from : Node, to : Node) : Bool
Validates movement between nodes
Sourcecan_move_diagonally?(grid : NavigationGrid, from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Bool
Checks if diagonal movement is valid (prevents corner cutting)
Sourcediagonal_cost=(diagonal_cost : Float32)
Sourceget_movement_type
Gets movement type description
Sourceget_valid_neighbors(grid : NavigationGrid, x : Int32, y : Int32) : Array(Tuple(Int32, Int32))
Gets all valid neighbor positions for a given position
Sourceget_valid_neighbors(grid : NavigationGrid, node : Node) : Array(Node)
Gets all valid neighbor nodes for a given node
Sourceis_diagonal_move?(from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Bool
Checks if movement is diagonal
Sourceis_diagonal_move?(from : Node, to : Node) : Bool
Checks if movement between nodes is diagonal
Sourceis_path_valid?(grid : NavigationGrid, path : Array(RL::Vector2)) : Bool
Validates if a complete path is still valid
Sourceorthogonal_cost=(orthogonal_cost : Float32)
Sourceprevent_corner_cutting=(prevent_corner_cutting : Bool)
Sourcevalidate_configuration
Validates movement configuration
Source