Kiwi.Time.ClockManager Class
Handles the generation and tracking of Clocks and Time related applications for a single game.
Constructor
Kiwi.Time.ClockManager
-
game.
Parameters:
-
game.
Kiwi.Game
Returns:
This Object.
Item Index
Methods
addClock
-
name
-
[units=1000]
Creates a Clock class for keeping time relative to the MasterClock.
Parameters:
-
name
StringThe name of the Clock.
-
[units=1000]
Number optionalThe number of milliseconds that make up one unit of time on this clock. Default 1000.
Returns:
A reference to the newly created Clock object.
boot
()
public
When all of the DOM elements that the game requires have loaded successfully then this object will 'boot'.
delta
()
Number
public
Returns the delta of the master clock.
Returns:
elapsed
()
Number
public
Returns the elapsed time. Based on the master clock.
Returns:
getClock
-
name
Returns the Clock with the matching name. Throws an error if no Clock with that name exists
Parameters:
-
name
StringThe name of the Clock to be returned.
Returns:
The clock which matches the name given.
now
()
Number
public
Returns the current time. Based on the master clock.
Returns:
objType
()
String
public
The type of object this is.
Returns:
"ClockManager"
setMasterInterval
-
interval
Sets the interval on the master clock.
Parameters:
-
interval
NumberThe ideal frame interval in milliseconds.
update
()
public
Is executed every frame and updates all of the clocks that exist on this manager.
Properties
_clocks
Array
private
An array containing all of the clocks that exist on this manager.
clock
Kiwi.Time.Clock
public
The default Game Clock - you can use this via this.game.time.clock. Uses a 1000 millisecond time unit.
rate
Number
public
Frame rate factor, derived from master clock