Class: Game

Game(canvas)

Defines the main game controller object. Manages game state, user input and game objects.

Constructor

new Game(canvas)

Creates a game
Parameters:
Name Type Description
canvas Object The canvas element for rendering
Source:

Members

ball

Gets the ball game object
Source:

blocks

Gets the blocks game object
Source:

paddle

Gets the paddle game object
Source:

Methods

increaseScore()

Increments the score counter
Source:

loop(time)

Runs the game loop. Should only be called via requestAnimationFrame
Parameters:
Name Type Description
time number current time in miliseconds
Source:

loseALife()

Decrements the lives counter and sets the ball and paddle back to default position.
Source: