Class: Score

Score(game)

new Score(game)

Represents Score
Parameters:
Name Type Description
game Game the game to associate with the score
Properties:
Name Type Default Description
isCollidable Boolean false value if the object can be collided with. Defaults false.
score Number the value that holds the score number
displayScore Boolean true value if the score should be shown or not. Defaults to true.
scoreColor String "black" value of the color that score wil be draw in. Can be word colors or hex values. Defaults to "black"
scoreFont String "bold 12px Palatino Linotype" - value of the font that score will draw in. Defaults to "bold 12px Palatino Linotype"
scoreX Number 0 the x coordinate of the score. Defaults to zero.
scoreY Number 0 the y coordinate of the score. Defaults to 10.
Source:

Methods

addScore(score)

Adds a number to the score
Parameters:
Name Type Description
score Number number to add to the current score
Source:

constructor(game)

Creates a Score object
Parameters:
Name Type Description
game Game the game to associate with the score
Source:

getScore()

Gets the score
Source:
Returns:
the score

restart()

Resets the score to 0
Source:

setColor(color)

Sets the color of the Score
Parameters:
Name Type Description
color String the color you want the score to be
Source:

setDisplay(display)

Sets if the score is showing on the canvas
Parameters:
Name Type Description
display Boolean true if you want score to show, false if you want it to disappear
Source:

setFont(font)

Sets the font of the Score
Parameters:
Name Type Description
font String the font of the color
Source:

setX(x)

Sets the x coordinate of the Score
Parameters:
Name Type Description
x Number the x coordinate of the Score
Source:

setY(y)

Sets the y coordinate of the Score
Parameters:
Name Type Description
y Number the y coordinate of the Score
Source:

substractScore(score)

Subtracts a number from the score
Parameters:
Name Type Description
score Number number to subtract from the current score
Source: