Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Heuristic

[15:7] extends: FxObj

Wraps FXGL's Heuristic abstract base (com.almasb.fxgl.pathfinding.heuristic.Heuristic), the cost function h(n) used by A*. The concrete subclasses are ManhattanDistance and DiagonalHeuristic (with OctileDistance underneath). Use this wrapper to adopt a Heuristic AJO and query its weight or per-pair cost.

Methods

  • Heuristic ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing Heuristic AussomJavaObject.

  • getWeight ()

    Returns the base weight applied to the heuristic.

  • getCost (int StartX, int StartY, int TargetX, int TargetY)

    Returns the estimated cost from (StartX, StartY) to (TargetX, TargetY).