new Time(game)
Time constructor.
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
- Source:
Members
-
_justResumed
-
Description.
- Default Value:
- false
- Source:
Properties:
Name Type Description _justResumed
boolean -
elapsed
-
Elapsed time since the last frame.
- Default Value:
- 0
- Source:
Properties:
Name Type Description elapsed
number -
fps
-
Frames per second.
- Default Value:
- 0
- Source:
Properties:
Name Type Description fps
number -
fpsMax
-
The highest rate the fps has reached (usually no higher than 60fps).
- Default Value:
- 0
- Source:
Properties:
Name Type Description fpsMax
number -
fpsMin
-
The lowest rate the fps has dropped to.
- Default Value:
- 1000
- Source:
Properties:
Name Type Description fpsMin
number -
frames
-
The number of frames record in the last second.
- Default Value:
- 0
- Source:
Properties:
Name Type Description frames
number -
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game Local reference to game.
-
lastTime
-
Internal value used by timeToCall as part of the setTimeout loop
- Default Value:
- 0
- Source:
Properties:
Name Type Description lastTime
number -
msMax
-
The maximum amount of time the game has taken between two frames.
- Default Value:
- 0
- Source:
Properties:
Name Type Description msMax
number -
msMin
-
The minimum amount of time the game has taken between two frames.
- Default Value:
- 1000
- Source:
Properties:
Name Type Description msMin
number -
now
-
The time right now.
- Default Value:
- 0
- Source:
Properties:
Name Type Description now
number -
pausedTime
-
Records how long the game has been paused for. Is reset each time the game pauses.
- Default Value:
- 0
- Source:
Properties:
Name Type Description pausedTime
number -
pauseDuration
-
Records how long the game was paused for in miliseconds.
- Default Value:
- 0
- Source:
Properties:
Name Type Description pauseDuration
number -
physicsElapsed
-
The elapsed time calculated for the physics motion updates.
- Default Value:
- 0
- Source:
Properties:
Name Type Description physicsElapsed
number -
time
-
Game time counter.
- Default Value:
- 0
- Source:
Properties:
Name Type Description time
number -
timeToCall
-
The value that setTimeout needs to work out when to next update
- Default Value:
- 0
- Source:
Properties:
Name Type Description timeToCall
number
Methods
-
elapsedSecondsSince(since) → {number}
-
How long has passed since the given time (in seconds).
Parameters:
Name Type Description since
number The time you want to measure (in seconds).
- Source:
Returns:
Duration between given time and now (in seconds).
- Type
- number
-
elapsedSince(since) → {number}
-
How long has passed since the given time.
Parameters:
Name Type Description since
number The time you want to measure against.
- Source:
Returns:
The difference between the given time and now.
- Type
- number
-
reset()
-
Resets the private _started value to now.
- Source:
-
totalElapsedSeconds() → {number}
-
The number of seconds that have elapsed since the game was started.
- Source:
Returns:
- Type
- number
-
update(time)
-
Updates the game clock and calculate the fps. This is called automatically by Phaser.Game.
Parameters:
Name Type Description time
number The current timestamp, either performance.now or Date.now depending on the browser.
- Source: