API Docs for: 1.0.0
Show:

TimeManager Class

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

Constructor

TimeManager

(
  • game
)

Parameters:

  • game Phaser.Game

    A reference to the currently running game.

Methods

elapsedSecondsSince

(
  • since
)
Number

How long has passed since the given time (in seconds).

Parameters:

  • since Number

    The time you want to measure (in seconds).

Returns:

Number:

Duration between given time and now (in seconds).

elapsedSince

(
  • since
)
Number

How long has passed since the given time.

Parameters:

  • since Number

    The time you want to measure against.

Returns:

Number:

The difference between the given time and now.

gamePaused

() private

Called when the game enters a paused state.

gameResumed

() private

Called when the game resumes from a paused state.

reset

()

Resets the private _started value to now.

totalElapsedSeconds

() Number

The number of seconds that have elapsed since the game was started.

Returns:

update

(
  • raf
)

Update clock and calculate the fps. This is called automatically by Game._raf

Parameters:

  • raf Number

    The current timestamp, either performance.now or Date.now

Properties

_pauseStarted

Number private

The time the game started being paused.

_started

Number private

The time at which the Game instance started.

_timeLastSecond

Number private

The time (in ms) that the last second counter ticked over.

delta

Number public

Elapsed time since the last frame.

elapsed

Number public

Number of milliseconds elapsed since the last frame update.

fps

Number public

Frames per second.

fpsMax

Number public

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

fpsMin

Number public

The lowest rate the fps has dropped to.

frames

Number public

The number of frames record in the last second.

game

Phaser.Game

A reference to the currently running Game.

msMax

Number public

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

msMin

Number public

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

now

Number public

The time right now.

pausedTime

Number public

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

pauseDuration

Number public

Records how long the game was paused for in miliseconds.

time

Number public

Game time counter.