Class: Time

Phaser. Time

This is the core internal game clock. It manages the elapsed time and calculation of elapsed values, used for game object motion and tweens.

new Time(game)

Time constructor.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

Source:

Members

_justResumed

Description.

Properties:
Name Type Description
_justResumed boolean
Default Value:
  • false
Source:

elapsed

Elapsed time since the last frame.

Properties:
Name Type Description
elapsed number
Default Value:
  • 0
Source:

fps

Frames per second.

Properties:
Name Type Description
fps number
Default Value:
  • 0
Source:

fpsMax

The highest rate the fps has reached (usually no higher than 60fps).

Properties:
Name Type Description
fpsMax number
Default Value:
  • 0
Source:

fpsMin

The lowest rate the fps has dropped to.

Properties:
Name Type Description
fpsMin number
Default Value:
  • 1000
Source:

frames

The number of frames record in the last second.

Properties:
Name Type Description
frames number
Default Value:
  • 0
Source:

game

Properties:
Name Type Description
game Phaser.Game

Local reference to game.

Source:

lastTime

Internal value used by timeToCall as part of the setTimeout loop

Properties:
Name Type Description
lastTime number
Default Value:
  • 0
Source:

msMax

The maximum amount of time the game has taken between two frames.

Properties:
Name Type Description
msMax number
Default Value:
  • 0
Source:

msMin

The minimum amount of time the game has taken between two frames.

Properties:
Name Type Description
msMin number
Default Value:
  • 1000
Source:

now

The time right now.

Properties:
Name Type Description
now number
Default Value:
  • 0
Source:

pausedTime

Records how long the game has been paused for. Is reset each time the game pauses.

Properties:
Name Type Description
pausedTime number
Default Value:
  • 0
Source:

pauseDuration

Records how long the game was paused for in miliseconds.

Properties:
Name Type Description
pauseDuration number
Default Value:
  • 0
Source:

physicsElapsed

The elapsed time calculated for the physics motion updates.

Properties:
Name Type Description
physicsElapsed number
Default Value:
  • 0
Source:

time

Game time counter.

Properties:
Name Type Description
time number
Default Value:
  • 0
Source:

timeToCall

The value that setTimeout needs to work out when to next update

Properties:
Name Type Description
timeToCall number
Default Value:
  • 0
Source:

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:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Nov 07 2013 06:07:41 GMT-0000 (GMT) using the DocStrap template.