Game

Game

Controls main actions directly related to the game itself.

Constructor

new Game(canvas, cardBack)

Contruct

Source:
Parameters:
Name Type Description
canvas Array

List of canvas elements to be drawn image on.

cardBack HTMLImageElement

Image element to be drown as card back face.

Classes

Game

Contruct

Methods

addImage(img)

Includes given image to the game.

Source:
Parameters:
Name Type Description
img HTMLImageElement

image to be added.

prepare()

Prepares the Game.

Source:

Prepares the Game.

openCard(canvas)

Opens card by drawing it's image on given canvas.

Source:
Parameters:
Name Type Description
canvas HTMLCanvasElement

Elment to be opened.

closeCard(canvas)

Closes card by drawing cardback image on given canvas.

Source:

Closes card by drawing cardback image on given canvas.

Parameters:
Name Type Description
canvas HTMLCanvasElement

Canvas element to be closed.

drawImageOnCanvas(canvas, image)

Draws any image on given canvas.

Source:

Draws any image on given canvas.

Parameters:
Name Type Description
canvas HTMLCanvasElement

target element to be drawn on to.

image HTMLImageElement

Image drawn on.

nextLevel(options) → {string}

Calculates dimensions of next level.

Source:

Calculates dimensions of next level.

Parameters:
Name Type Description
options Object

All attriburtes.

Returns:

Matrix of the next level.

Type
string