Class: HighScore

HighScore(max)

new HighScore(max)

Represents HighScore
Parameters:
Name Type Description
max Number the max number of high scores to keep track of.
Properties:
Name Type Description
highScoreMax Number the maximum number of high scores to keep track of.
highScores Array the array that holds the high score. Each position in the array holds another array with the value ["name", score].
Source:

Methods

(static) getHighScores(nameopt)

Gets the high scores list from the local browser session
Parameters:
Name Type Attributes Default Description
name String <optional>
"" name used when saving high scores list
Source:

addHighScore(user, highscore)

Adds the high score to the high score list
Parameters:
Name Type Description
user string the name of the user that got the high score
highscore Number the high score
Source:

constructor(max)

Creates a HighScore object
Parameters:
Name Type Description
max Number the max number of high scores to keep track of.
Source:

getHighScoreAt(index) → {Number}

Returns the high score at some index
Parameters:
Name Type Description
index Number the index to get the high score at
Source:
Returns:
the high score at the specified index
Type
Number

getNameAt(index) → {String}

Returns the name of the high score at some index
Parameters:
Name Type Description
index Number the index to get the high score name at
Source:
Returns:
the name of the high score at the specified index
Type
String

isHighScore(score) → {Boolean}

Checks if the score given should be in the high score list
Parameters:
Name Type Description
score Number the score to check if it should be in the high score list
Source:
Returns:
true if it is a high score or false if it is not
Type
Boolean

saveHighScores(nameopt)

Saves the high scores list to the local browser session
Parameters:
Name Type Attributes Default Description
name String <optional>
"" identifier for file name to distinguish it from other games
Source: