Timer

Timer

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

Constructor

new Timer(name)

Parameters:
Name Type Description
name

The name of the timer.

Source:

Methods

getName()

Get the name of the timer

Returns:
Type Description

The name of the timer

Source:

getTime()

Get the time of the timer, in milliseconds.

Returns:
Type Description

The time of the timer, in milliseconds.

Source:

isPaused()

Check if the timer is paused.

Source:

reset()

Reset the time to zero.

Source:

setPaused(enable)

Set if the timer is paused.

Parameters:
Name Type Description
enable

true to pause the timer, false otherwise.

Source:

setTime(time)

Change the time.

Parameters:
Name Type Description
time

The new time, in milliseconds.

Source:

updateTime(time)

Notify the timer that some time has passed.

Parameters:
Name Type Description
time

The elapsed time, in milliseconds.

Source: