Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: AStarCell

[15:7] extends: Cell

Wraps FXGL's AStarCell, a Cell subclass that adds CellState (WALKABLE / NOT_WALKABLE) and movement-cost tuning for the A* pathfinder. Holds the same X / Y / userData as the base Cell plus the extra pathfinding state.

Methods

  • AStarCell (int X = 0, int Y = 0, string StateName = "WALKABLE")

    Creates a new AStarCell at the given coordinates with the given CellState.

    • @p X is the column.
    • @p Y is the row.
    • @p StateName is the CellState name: "WALKABLE" or "NOT_WALKABLE".
  • adopt (object Ajo)

    Wraps an existing AStarCell AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an AStarCell.
    • @r A new wrapper.
  • getX ()

    Returns the cell's X coordinate.

    • @r An int.
  • getY ()

    Returns the cell's Y coordinate.

    • @r An int.
  • getState ()

    Returns the cell state name ("WALKABLE" or "NOT_WALKABLE").

    • @r A string.
  • setState (string StateName)

    Sets the cell state by name.

    • @p StateName is "WALKABLE" or "NOT_WALKABLE".
    • @r this object
  • isWalkable ()

    Returns whether the cell is walkable.

    • @r A bool.
  • getMovementCost ()

    Returns the movement cost into this cell (default 30).

    • @r An int.
  • setMovementCost (int Cost)

    Sets the movement cost into this cell.

    • @p Cost is the new cost.
    • @r this object
  • getUserData ()

    Returns the per-cell user-data (set by gameplay code, often to attach an Entity or tile metadata to the cell).

    • @r An AussomJavaObject around the user data, or null.
  • setUserData (Data)

    Sets the per-cell user data.

    • @p Data is the value to attach.
    • @r this object
  • getFCost ()

    Returns the F cost (gCost + hCost) used by the A* pathfinder.

  • getGCost ()

    Returns the G cost (cumulative cost from start).

  • setGCost (int V)

    Sets the G cost.

  • getHCost ()

    Returns the H cost (heuristic estimate to goal).

  • setHCost (int V)

    Sets the H cost.

  • getParent ()

    Returns the parent AStarCell in the current path (or null when this cell has no predecessor).

  • setParent (object ParentCell)

    Sets the parent AStarCell. Used by the A* pathfinder to wire up the path linkage.