Options
All
  • Public
  • Public/Protected
  • All
Menu

Class _GameTimer

This class keeps track of game time. That includes both total running time, and "active time" (time not spent on paused screens, etc.).

constructor

Hierarchy

  • _GameTimer

Index

Constructors

constructor

Properties

Private _notUpdatingStart

_notUpdatingStart: any

Private _pauseStart

_pauseStart: any

Private _paused

_paused: any

Private _startShift

_startShift: any

Private _updating

_updating: any

paused

paused: boolean

Sets whether the game is paused. The game is still told to handle input, update itself and render. This is simply a flag that should be set whenever a "pause" screen is displayed. It stops the "in-game timer" until the game is unpaused.

param

Whether the game should be paused.

see

setUpdating

playTime

playTime: number

Returns the length of time the game has been played so far. This is "playable time;" that is, time in which the user is playing, and the game is not paused or in a "not updating" state (such as the main frame not having focus).

returns

The amount of time the game has been played, in milliseconds.

see

resetPlayTime

updating

updating: boolean

Sets whether the game should be "updating" itself. If a game is not "updating" itself, then it is effectively "paused," and will not accept any input from the user.

This method can be used to temporarily "pause" a game when the game window loses focus, for example.

param

Whether the game should be updating itself.

Methods

resetPlayTime

  • resetPlayTime(): void
  • Resets the "playtime in milliseconds" timer back to 0.

    see

    playTime

    Returns void

start

  • start(): void
  • Resets this timer. This should be called when a new game is started.

    Returns void

Generated using TypeDoc