Class: Score

modules/Score.Score()

Manages scores and interacts with DOM elements related to them.

Constructor

new Score()

Source:
See:
  • Communicator

Extends

  • Communicator

Members

domElements :Object.<string, Element>

Type:
  • Object.<string, Element>
Properties:
Name Type Description
session Element

Displays the session score.

high Element

Displays the high score.

Source:

highScore :number

The high score.

Type:
  • number
Source:

paddedLength :number

The character-length to left-pad scores to.

Type:
  • number
Source:

sessionScore :number

The session score.

Type:
  • number
Source:

Methods

addPointsToSessionScore(points)

Multiplies the provided points value by the current timescale multiplier, adds that product to ehe session score, then sets the session score.

Parameters:
Name Type Description
points number

The number of points to add to the session score.

Source:

highScore(score)

Sets the high score and updates the high score DOM element.

Parameters:
Name Type Description
score number

The number of points to set the high score to.

Source:

initialize()

Sets the initial state.

Source:

pointsReceive()

Adds points to the session score.

Source:
See:
  • Score#receive

processReceive()

Sets the session score to 0.

Source:
See:
  • Score#receive

sessionScore(points)

Sets the session score, updates the session score DOM element, and conditionally sets the high score.

Parameters:
Name Type Description
points number

The number of points to set the session score to.

Source:

updateHighScoreElementText()

Sets the high score DOM element content to the current high score.

Source:

updateSessionElementText()

Sets the session score DOM element content to the current session score.

Source: