class

PointClickEngine::Navigation::MovementValidator

Inherits Reference < Object

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

Source
for_point_and_click

Creates validator with optimal settings for point and click games

Source
for_strategy

Creates validator for strategy games

Source
new(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)
Source

Instance methods

allow_diagonal
Source
allow_diagonal=(allow_diagonal : Bool)
Source
calculate_move_cost(from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Float32

Calculates movement cost between two positions

Source
calculate_move_cost(from : Node, to : Node) : Float32

Calculates movement cost between nodes

Source
can_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

Source
can_move?(grid : NavigationGrid, from : Node, to : Node) : Bool

Validates movement between nodes

Source
can_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)

Source
diagonal_cost
Source
diagonal_cost=(diagonal_cost : Float32)
Source
get_movement_type

Gets movement type description

Source
get_valid_neighbors(grid : NavigationGrid, x : Int32, y : Int32) : Array(Tuple(Int32, Int32))

Gets all valid neighbor positions for a given position

Source
get_valid_neighbors(grid : NavigationGrid, node : Node) : Array(Node)

Gets all valid neighbor nodes for a given node

Source
is_diagonal_move?(from_x : Int32, from_y : Int32, to_x : Int32, to_y : Int32) : Bool

Checks if movement is diagonal

Source
is_diagonal_move?(from : Node, to : Node) : Bool

Checks if movement between nodes is diagonal

Source
is_path_valid?(grid : NavigationGrid, path : Array(RL::Vector2)) : Bool

Validates if a complete path is still valid

Source
orthogonal_cost
Source
orthogonal_cost=(orthogonal_cost : Float32)
Source
prevent_corner_cutting
Source
prevent_corner_cutting=(prevent_corner_cutting : Bool)
Source
to_s(io : IO) : Nil

String representation

Source
validate_configuration

Validates movement configuration

Source
validate_pathfinding_input(grid : NavigationGrid, start_x : Float32, start_y : Float32, end_x : Float32, end_y : Float32) : Bool

Validates pathfinding input parameters

Source