Constructor
new Game(canvas)
Creates a game
Parameters:
Name | Type | Description |
---|---|---|
canvas |
Object | The canvas element for rendering |
Members
ball
Gets the ball game object
blocks
Gets the blocks game object
paddle
Gets the paddle game object
Methods
increaseScore()
Increments the score counter
loop(time)
Runs the game loop. Should only be called via requestAnimationFrame
Parameters:
Name | Type | Description |
---|---|---|
time |
number | current time in miliseconds |
loseALife()
Decrements the lives counter and sets the ball and paddle
back to default position.