Timer

Timer

Methods


create_timer(autoDestroy)

Parameters:
Name Type Description
autoDestroy Boolean

whether or not the timer should automatically destroy when it's done

Code Equivalent:
game.time.create(autoDestroy)

delta_time_milliseconds()


Returns the physics update delta in milliseconds.

Check out the third party documentation for a more in depth explanation.

Code Equivalent:
game.time.physicsElapsedMS

delta_time_seconds()

Code Equivalent:
game.time.physicsElapsed

get_time_numeric_member(field)


Returns the chosen numeric field value of the game timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to get

Code Equivalent:
game.time.field

get_timer_boolean_member(field, timer)


Returns the chosen boolean field value of the timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to get

timer

timer to get the values from

Code Equivalent:
timer.field

get_timer_numeric_member(field, timer)


Returns the chosen numeric field value of the timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to get

timer

timer to get the values from

Code Equivalent:
game.time.physicsElapsedMS

set_time_numeric_member(field, value)


Assigns the chosen numeric field for the game timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to set

value

value to set the field to

Code Equivalent:
game.time.field = value;

set_timer_boolean_member(field, timer, value)


Assigns the chosen boolean field for the timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to set

timer

timer to assign values for

value

value to set the field to

Code Equivalent:
timer.field = value;

set_timer_numeric_member(field, timer, value)


Assigns the chosen numeric field for the timer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
field

the value to set

timer

timer to assign values for

value

value to set the field to

Code Equivalent:
timer.field

start_timer(delay, timer)


Start the chosen timer after the given amount of time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
delay Number

how long to wait before starting the timer

timer

timer to start

Code Equivalent:
timer.start(delay);

time_constants(constant)

Parameters:
Name Type Description
constant

which time value to return

Code Equivalent:
constant

timer_add_event_complex(delay, callback, timer, arguments)


Adds an event to the timer, to be called after the given amount of time, once the timer has started running. The delay applies only after the timer has started.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
delay Number

the number of milliseconds before the timer function is called

callback

the function to call

timer

timer to add the function call event to

arguments

(optional) arguments to use in the function that gets called

Code Equivalent:
timer.add(delay, callback, undefined, code);

timer_destroy(timer)


Destroy the timer and stops any future related events from happening.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
timer

timer to destroy

Code Equivalent:
timer.destroy();

timer_loop_event_complex(delay, callback, timer, arguments)


Adds an event to the timer, to be called continuously after the given amount of time, once the timer has started running. The delay applies only after the timer has started.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
delay Number

the number of milliseconds before the timer function is called

callback

the function to call

timer

timer to add the function call event to

arguments

(optional) arguments to use in the function that gets called

Code Equivalent:
timer.loop(delay, callback, code);

timer_loop_event_complex(delay, repeatCount, callback, timer, arguments)


Adds an event to the timer, to be called continuously after the given amount of time for the given number of times, once the timer has started running. The delay applies only after the timer has started.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
delay Number

the number of milliseconds before the timer function is called

repeatCount Number

the number of times to call the event

callback

the function to call

timer

timer to add the function call event to

arguments

(optional) arguments to use in the function that gets called

Code Equivalent:
timer.loop(delay, callback, code);

timer_pause(timer)

Parameters:
Name Type Description
timer

timer to pause

Code Equivalent:
timer.pause();

timer_resume(timer)


Resumes the timer and all future related events.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
timer

timer to resume

Code Equivalent:
timer.resume();

timer_set_on_complete_callback(timer, callback)


Call the given function once the timer has completed and has no other events to call.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
timer

timer to use

callback

function to call

Code Equivalent:
timer.onComplete.add(callback);

timer_stop(timer, clearEvents)


Stops the timer, with the option to clear the related events.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
timer

timer to stop

clearEvents Boolean

option to keep or remove events related to the timer

Code Equivalent:
timer.stop(clearEvents);