-
Notifications
You must be signed in to change notification settings - Fork 9
Ticks
Giorgio Garofalo edited this page Jan 19, 2021
·
1 revision
A tick is a time unit equivalent to 1/20
seconds and is the way the game handles timing.
Chorus allows converting ticks to other time units and vice-versa within the JavaScript API thanks to the timeToTicks(type, time)
and ticksToTime(type, ticks)
functions.
type
refers to the time unit you want the conversion applied to. Available types:
ms/millis/milliseconds
sec/seconds
min/minutes
hr/hours
days
time
and ticks
refer to any number (parsed or not).
Example:
print('Ticks in 1 second: ' + timeToTicks('sec', 1));
print('Minutes in 300 ticks: ' + ticksToTime('minutes', 300));
Output:
Ticks in 1 second: 20
Minutes in 300 ticks: 0.25