Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Timer

The Excalibur timer hooks into the internal timer and fires callbacks, after a certain interval, optionally repeating.

Hierarchy

  • Timer

Index

Constructors

constructor

  • new Timer(fcn: function, interval: number, repeats?: boolean): Timer
  • Parameters

    • fcn: function

      The callback to be fired after the interval is complete.

        • (): void
        • Returns void

    • interval: number

      Interval length

    • Optional repeats: boolean

      Indicates whether this call back should be fired only once, or repeat after every interval as completed.

    Returns Timer

Properties

Private _elapsedTime

_elapsedTime: number = 0

Private _totalTimeAlive

_totalTimeAlive: number = 0

complete

complete: boolean = false

id

id: number = 0

interval

interval: number = 10

repeats

repeats: boolean = false

scene

scene: Scene = null

Static id

id: number = 0

Methods

cancel

  • cancel(): void
  • Cancels the timer, preventing any further executions.

    Returns void

fcn

  • fcn(): void
  • Returns void

getTimeRunning

  • getTimeRunning(): number
  • Returns number

update

  • update(delta: number): void
  • Updates the timer after a certain number of milliseconds have elapsed. This is used internally by the engine.

    Parameters

    • delta: number

      Number of elapsed milliseconds since the last update.

    Returns void