jetlag2d
    Preparing search index...

    Class ChaseMovement

    A rule for moving by chasing some other actor

    Index
    • Specify that this actor is supposed to chase another actor

      Parameters

      • cfg: {
            chaseInX?: boolean;
            chaseInY?: boolean;
            maxSpeed?: number;
            minSpeed?: number;
            multiplier?: number;
            scaleSpeedWithDistance?: boolean;
            speed: number;
            speedDistanceScale?: number;
            target: Actor;
            teleportDistance?: number;
        }
        • OptionalchaseInX?: boolean

          Optional: Should the actor change its x velocity?

        • OptionalchaseInY?: boolean

          Optional: Should the actor change its y velocity?

        • OptionalmaxSpeed?: number

          Optional: a ceiling for the scaled speed

        • OptionalminSpeed?: number

          Optional: a floor for the scaled speed

        • Optionalmultiplier?: number

          Optional scaling factor for changing how fast the actor chases (default is 2) (useful when chaseInX or chaseInY is false)

        • OptionalscaleSpeedWithDistance?: boolean

          Optional: should the chase speed grow with the distance to the target? (default false)

        • speed: number

          The speed with which it chases the other actor

        • OptionalspeedDistanceScale?: number

          Optional: how much speed to add per meter of distance (default 0.1; only used when scaleSpeedWithDistance is true)

        • target: Actor

          The actor to chase

        • OptionalteleportDistance?: number

          Optional: if the target is farther away than this many meters, teleport to it instead of chasing

      Returns ChaseMovement

    enabled: boolean = true

    Is this actor currently chasing its target? If not, it stands still.

    target: Actor

    The actor to chase. It can be changed at any time.