Timer

Module: engine.timer
new game.Timer([time])

Parameters:

  • time Number (optional)

    Timer's target time (milliseconds)

Properties

_base Number

(No description yet)

_last Number

(No description yet)

_pause Number

(No description yet)

callback Function

Function to call, when timer's time is reached.

repeat Boolean

Should timer repeat.

target Number

Timer's target time.

Methods

add(time, callback, [repeat], [instant]) Timer Static

Add timer to scene.

Parameters:

  • time Number

    Time (ms).

  • callback Function

    Callback function to run, when timer ends.

  • repeat Boolean (optional)
  • instant Boolean (optional)
clear()

Clear timer.

delta() Number

Get time since last frame.

delta

pause()

Pause timer.

reset()

Reset timer.

resume()

Resume paused timer.

set(ms)

Set target time for timer.

Parameters:

  • ms Number
time() Number

Get time left.

time

update() Static

Update main timer.

Attributes

_last Number

(No description yet)

_lastFrameTime Number

(No description yet)

_realDelta Number

(No description yet)

delta Number

Main timer's delta (ms).

minFPS Number (Default: 20)

Main timer's minimum fps.

speed Number (Default: 1)

Main timer's speed factor.

time Number

Current time.