Class: Timer

Timer

new gdjs.Timer(name)

Represents a timer, which must be updated manually with gdjs.Timer#updateTime.

Name Type Description
name string

The name of the timer.

Methods

getName(){string}

Get the name of the timer

Returns:
Type Description
string The name of the timer

getTime(){number}

Get the time of the timer, in milliseconds.

Returns:
Type Description
number The time of the timer, in milliseconds.

isPaused()

Check if the timer is paused.

reset()

Reset the time to zero.

setPaused(enable)

Set if the timer is paused.

Name Type Description
enable boolean

true to pause the timer, false otherwise.

setTime(time)

Change the time.

Name Type Description
time number

The new time, in milliseconds.

updateTime(time)

Notify the timer that some time has passed.

Name Type Description
time number

The elapsed time, in milliseconds.