Options
All
  • Public
  • Public/Protected
  • All
Menu

PathfindingRuntimeBehavior represents a behavior allowing objects to follow a path computed to avoid obstacles.

Hierarchy

Index

Methods

  • activate(enable: boolean): void
  • De/Activate the behavior

    Parameters

    • enable: boolean

      true to enable the behavior, false to disable it

    Returns void

  • activated(): boolean
  • allowDiagonals(allow: boolean): void
  • Parameters

    • allow: boolean

    Returns void

  • destinationReached(): boolean
  • Return true if the object reached its destination.

    Returns boolean

  • diagonalsAllowed(): boolean
  • Returns boolean

  • euclideanDistance(a: FloatPoint, b: FloatPoint): number
  • Compute the euclidean distance between two positions.

    memberof

    gdjs.PathfindingRuntimeBehavior

    Parameters

    • a: FloatPoint
    • b: FloatPoint

    Returns number

  • getAcceleration(): number
  • Returns number

  • getAngleOffset(): number
  • Returns number

  • getAngularMaxSpeed(): number
  • Returns number

  • getCellHeight(): number
  • Returns number

  • getCellWidth(): number
  • Returns number

  • getDestinationX(): number
  • Returns number

  • getDestinationY(): number
  • Returns number

  • getExtraBorder(): number
  • Returns number

  • getGridOffsetX(): number
  • Returns number

  • getGridOffsetY(): number
  • Returns number

  • getLastNodeX(): number
  • Returns number

  • getLastNodeY(): number
  • Returns number

  • getMaxSpeed(): number
  • Returns number

  • getMovementAngle(): number
  • Returns number

  • getName(): string
  • getNameId(): number
  • Get the name identifier of the behavior.

    Returns number

    The behavior's name identifier.

  • getNextNodeIndex(): number
  • Returns number

  • getNextNodeX(): number
  • Returns number

  • getNextNodeY(): number
  • Returns number

  • getNodeCount(): number
  • Returns number

  • getNodeX(index: number): number
  • Parameters

    • index: number

    Returns number

  • getNodeY(index: number): number
  • Parameters

    • index: number

    Returns number

  • getSpeed(): number
  • Returns number

  • isObjectRotated(): boolean
  • Returns boolean

  • manhattanDistance(a: FloatPoint, b: FloatPoint): number
  • Compute the taxi distance between two positions.

    memberof

    gdjs.PathfindingRuntimeBehavior

    Parameters

    • a: FloatPoint
    • b: FloatPoint

    Returns number

  • Compute and move on the path to the specified destination.

    Parameters

    Returns void

  • movementAngleIsAround(degreeAngle: number, tolerance: number): boolean
  • Parameters

    • degreeAngle: number
    • tolerance: number

    Returns boolean

  • onActivate(): void
  • Reimplement this method to do extra work when the behavior is activated (after it has been deactivated, see onDeActivate).

    Returns void

  • onCreated(): void
  • Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

    Returns void

  • onDeActivate(): void
  • onDestroy(): void
  • This method is called when the owner of the behavior is being removed from the scene and is about to be destroyed/reused later or when the behavior is removed from an object (can happen in case of hot-reloading only. Otherwise, behaviors are just de-activated, not removed. See onDeActivate).

    Returns void

  • onObjectHotReloaded(): void
  • This method is called when the owner of the behavior was hot reloaded, so its position, angle, size can have been changed outside of events.

    Returns void

  • pathFound(): boolean
  • Return true if the latest call to moveTo succeeded.

    Returns boolean

  • setAcceleration(acceleration: number): void
  • Parameters

    • acceleration: number

    Returns void

  • setAngleOffset(angleOffset: number): void
  • Parameters

    • angleOffset: number

    Returns void

  • setAngularMaxSpeed(angularMaxSpeed: number): void
  • Parameters

    • angularMaxSpeed: number

    Returns void

  • setCellHeight(height: number): void
  • Parameters

    • height: number

    Returns void

  • setCellWidth(width: number): void
  • Parameters

    • width: number

    Returns void

  • setExtraBorder(extraBorder: any): void
  • Parameters

    • extraBorder: any

    Returns void

  • setGridOffsetX(gridOffsetX: number): void
  • Parameters

    • gridOffsetX: number

    Returns void

  • setGridOffsetY(gridOffsetY: number): void
  • Parameters

    • gridOffsetY: number

    Returns void

  • setMaxSpeed(maxSpeed: number): void
  • Parameters

    • maxSpeed: number

    Returns void

  • setRotateObject(allow: boolean): void
  • Parameters

    • allow: boolean

    Returns void

  • setSpeed(speed: number): void
  • Parameters

    • speed: number

    Returns void

  • Called at each frame after events. Call doStepPostEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • Called at each frame before events. Call doStepPreEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • updateFromBehaviorData(oldBehaviorData: any, newBehaviorData: any): boolean
  • Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.

    Parameters

    • oldBehaviorData: any
    • newBehaviorData: any

    Returns boolean

    true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).

Constructors

Properties

name: string
type: string

Generated using TypeDoc