Options
All
  • Public
  • Public/Protected
  • All
Menu

PlatformerObjectRuntimeBehavior represents a behavior allowing objects to be considered as a platform by objects having PlatformerObject Behavior.

Hierarchy

Index

Methods

  • abortJump(): void
  • Abort the current jump.

    When the character is not in the jumping state this method has no effect.

    Returns void

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

    Parameters

    • enable: boolean

      true to enable the behavior, false to disable it

    Returns void

  • activated(): boolean
  • canGrabPlatforms(): boolean
  • Check if the Platformer Object can grab the platforms.

    Returns boolean

    Returns true if the object can grab the platforms.

  • canJump(): boolean
  • Check if the Platformer Object can jump.

    Returns boolean

    Returns true if the object can jump.

  • getAcceleration(): number
  • Get the acceleration value of the Platformer Object.

    Returns number

    The current acceleration.

  • getCurrentFallSpeed(): number
  • Get the speed at which the object is falling. It is 0 when the object is on a floor, and non 0 as soon as the object leaves the floor.

    Returns number

    The current fall speed.

  • getCurrentJumpSpeed(): number
  • Get the current jump speed of the Platformer Object.

    Returns number

    The current jump speed.

  • getCurrentSpeed(): number
  • Get the current speed of the Platformer Object.

    Returns number

    The current speed.

  • getDeceleration(): number
  • Get the deceleration of the Platformer Object.

    Returns number

    The current deceleration.

  • getGravity(): number
  • Get the gravity of the Platformer Object.

    Returns number

    The current gravity.

  • getJumpSpeed(): number
  • Get the jump speed of the Platformer Object.

    Returns number

    The jump speed.

  • getJumpSustainTime(): number
  • Get the jump sustain time of the Platformer Object.

    Returns number

    The jump sustain time.

  • getLadderClimbingSpeed(): number
  • Get the speed used to move on Y axis when climbing a ladder.

    Returns number

    The speed of ladder climbing.

  • getMaxFallingSpeed(): number
  • Get the maximum falling speed of the Platformer Object.

    Returns number

    The maximum falling speed.

  • getMaxSpeed(): number
  • Get the maximum speed of the Platformer Object.

    Returns number

    The maximum speed.

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

    Returns number

    The behavior's name identifier.

  • getSlopeMaxAngle(): number
  • Get maximum angle of a slope for the Platformer Object to run on it as a floor.

    Returns number

    the slope maximum angle, in degrees.

  • ignoreDefaultControls(ignore: boolean): void
  • Ignore the default controls of the Platformer Object.

    Parameters

    • ignore: boolean

      Enable / Disable default controls.

    Returns void

  • isFalling(): boolean
  • Check if the Platformer Object is "going down", either because it's in the falling state or because it's jumping but reached the jump peak and is now going down (because the jump speed can't compensate anymore the falling speed).

    If you want to check if the object is falling outside of a jump (or because the jump is entirely finished and there is no jump speed applied to the object anymore), consider using isFallingWithoutJumping.

    Returns boolean

    Returns true if it is "going down" and false if not.

  • isFallingWithoutJumping(): boolean
  • Check if the Platformer Object is in the falling state. This is false if the object is jumping, even if the object is going down after reaching the jump peak.

    Returns boolean

    Returns true if it is falling and false if not.

  • isGrabbingPlatform(): boolean
  • Check if the Platformer Object is grabbing a platform.

    Returns boolean

    Returns true if a platform is grabbed and false if not.

  • isJumping(): boolean
  • Check if the Platformer Object is jumping.

    Returns boolean

    Returns true if jumping and false if not.

  • isMoving(): boolean
  • Check if the Platformer Object is moving.

    When walking or climbing on a ladder, a speed of less than one pixel per frame won't be detected.

    deprecated

    use isMovingEvenALittle instead

    Returns boolean

    Returns true if it is moving and false if not.

  • isMovingEvenALittle(): boolean
  • Check if the Platformer Object is moving.

    Returns boolean

    Returns true if it is moving and false if not.

  • isOnFloor(): boolean
  • Check if the Platformer Object is on a floor.

    Returns boolean

    Returns true if on a floor and false if not.

  • Check if the Platformer Object is on the given object.

    Parameters

    Returns boolean

    Returns true if on the object and false if not.

  • isOnLadder(): boolean
  • Check if the Platformer Object is on a ladder.

    Returns boolean

    Returns true if on a ladder and false if not.

  • isUsingControl(input: string): boolean
  • .

    Parameters

    • input: string

      The control to be tested [Left,Right,Up,Down,Ladder,Jump,Release,Release Ladder].

    Returns boolean

    true if the key was used since the last doStepPreEvents call.

  • 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

  • setAcceleration(acceleration: number): void
  • Set the acceleration of the Platformer Object.

    Parameters

    • acceleration: number

      The new acceleration.

    Returns void

  • setCanGrabPlatforms(enable: boolean): void
  • Set if the Platformer Object can grab platforms.

    Parameters

    • enable: boolean

      Enable / Disable grabbing of platforms.

    Returns void

  • setCanJump(): void
  • Allow the Platformer Object to jump again.

    Returns void

  • setCanNotAirJump(): void
  • Forbid the Platformer Object to air jump.

    Returns void

  • setCurrentFallSpeed(currentFallSpeed: number): void
  • Set the current fall speed.

    When the character is not in the falling state this method has no effect.

    Parameters

    • currentFallSpeed: number

    Returns void

  • setCurrentSpeed(currentSpeed: number): void
  • Set the current speed of the Platformer Object.

    Parameters

    • currentSpeed: number

      The current speed.

    Returns void

  • setDeceleration(deceleration: number): void
  • Set the deceleration of the Platformer Object.

    Parameters

    • deceleration: number

      The new deceleration.

    Returns void

  • setGravity(gravity: number): void
  • Set the gravity of the Platformer Object.

    Parameters

    • gravity: number

      The new gravity.

    Returns void

  • setJumpSpeed(jumpSpeed: number): void
  • Set the jump speed of the Platformer Object.

    Parameters

    • jumpSpeed: number

      The new jump speed.

    Returns void

  • setJumpSustainTime(jumpSustainTime: number): void
  • Set the jump sustain time of the Platformer Object.

    Parameters

    • jumpSustainTime: number

    Returns void

  • setLadderClimbingSpeed(ladderClimbingSpeed: number): void
  • Set the speed used to move on Y axis when climbing a ladder.

    Parameters

    • ladderClimbingSpeed: number

      The speed of ladder climbing.

    Returns void

  • setMaxFallingSpeed(maxFallingSpeed: number, tryToPreserveAirSpeed?: boolean): void
  • Set the maximum falling speed of the Platformer Object.

    Parameters

    • maxFallingSpeed: number

      The maximum falling speed.

    • tryToPreserveAirSpeed: boolean = false

      If true and if jumping, tune the current jump speed to preserve the overall speed in the air.

    Returns void

  • setMaxSpeed(maxSpeed: number): void
  • Set the maximum speed of the Platformer Object.

    Parameters

    • maxSpeed: number

      The new maximum speed.

    Returns void

  • setSlopeMaxAngle(slopeMaxAngle: number): void
  • Set the maximum slope angle of the Platformer Object.

    Parameters

    • slopeMaxAngle: number

      The new maximum slope angle.

    Returns void

  • simulateControl(input: string): void
  • Simulate a control action in the Platformer Object by specifying an input.

    Parameters

    • input: string

      The string expression of the control action [Left,Right,Up,Down,Ladder,Jump,Release,Release Ladder].

    Returns void

  • simulateDownKey(): void
  • Simulate the "Down" control of the Platformer Object.

    Returns void

  • simulateJumpKey(): void
  • Simulate the "Jump" control of the Platformer Object.

    Returns void

  • simulateLadderKey(): void
  • Simulate the "Ladder" control of the Platformer Object.

    Returns void

  • simulateLeftKey(): void
  • Simulate the "Left" control of the Platformer Object.

    Returns void

  • simulateReleaseLadderKey(): void
  • Simulate the "Release Ladder" control of the Platformer Object.

    Returns void

  • simulateReleasePlatformKey(): void
  • Simulate the "Release" control of the Platformer Object.

    Returns void

  • simulateRightKey(): void
  • Simulate the "Right" control of the Platformer Object.

    Returns void

  • simulateUpKey(): void
  • Simulate the "Up" control of the Platformer Object.

    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
epsilon: number = ...

A very small value compare to 1 pixel, yet very huge compare to rounding errors.

Generated using TypeDoc