Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: FollowComponent

[17:7] extends: Component

Wraps FXGL's FollowComponent (com.almasb.fxgl.dsl.components.FollowComponent), which makes the owning entity follow a target Entity at a given speed while staying within a minDistance..maxDistance range. Inside minDistance it backs away; beyond maxDistance it advances; in between it idles.

Methods

  • FollowComponent (object TargetEntity = null, double Speed = 120.0, double MinDistance = 50.0, double MaxDistance = 100.0)

    Creates a new FollowComponent.

    • @p TargetEntity is an Entity wrapper, or null.
    • @p Speed is the move speed in pixels per second.
    • @p MinDistance is the comfort-zone inner radius.
    • @p MaxDistance is the comfort-zone outer radius.
  • adopt (object Ajo)

    Wraps an existing FollowComponent AussomJavaObject.

  • getTarget ()

    Returns the target Entity AJO (may be null).

  • setTarget (object TargetEntity = null)

    Sets the target Entity to follow.

    • @p TargetEntity is an Entity wrapper, or null.
    • @r this object
  • getSpeed ()

  • setSpeed (double V)

  • getMinDistance ()

  • setMinDistance (double V)

  • getMaxDistance ()

  • setMaxDistance (double V)

  • setMoveDelay (double Seconds)

    Sets the delay between moves once the target is in the comfort zone.

    • @p Seconds is the delay in seconds.
    • @r this object