new Time(game)
Time constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
- Source:
Members
-
elapsed
-
- Source:
Properties:
Name Type Description elapsednumber Elapsed time since the last frame.
-
fps
-
- Source:
Properties:
Name Type Description fpsnumber Frames per second.
-
fpsMax
-
- Source:
Properties:
Name Type Description fpsMaxnumber The highest rate the fps has reached (usually no higher than 60fps).
-
fpsMin
-
- Source:
Properties:
Name Type Description fpsMinnumber The lowest rate the fps has dropped to.
-
frames
-
- Source:
Properties:
Name Type Description framesnumber The number of frames record in the last second.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game Local reference to game.
-
lastTime
-
- Source:
Properties:
Name Type Description lastTimenumber Internal value used by timeToCall as part of the setTimeout loop
-
msMax
-
- Source:
Properties:
Name Type Description msMaxnumber The maximum amount of time the game has taken between two frames.
-
msMin
-
- Default Value:
- 1000
- Source:
Properties:
Name Type Description msMinnumber The minimum amount of time the game has taken between two frames.
-
now
-
- Source:
Properties:
Name Type Description nownumber The time right now.
-
pausedTime
-
- Source:
Properties:
Name Type Description pausedTimenumber Records how long the game has been paused for. Is reset each time the game pauses.
-
pauseDuration
-
- Source:
Properties:
Name Type Description pauseDurationnumber Records how long the game was paused for in miliseconds.
-
physicsElapsed
-
- Source:
Properties:
Name Type Description physicsElapsednumber The elapsed time calculated for the physics motion updates.
-
time
-
- Source:
Properties:
Name Type Description timenumber Game time counter.
-
timeToCall
-
- Source:
Properties:
Name Type Description timeToCallnumber The value that setTimeout needs to work out when to next update
Methods
-
elapsedSecondsSince(since) → {number}
-
How long has passed since the given time (in seconds).
Parameters:
Name Type Description sincenumber 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 sincenumber 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 timenumber The current timestamp, either performance.now or Date.now depending on the browser.
- Source: