Class: GameImage

GameImage(imageName, attrs)

Image drawable class

Constructor

new GameImage(imageName, attrs)

Constructor of Image drawable

Parameters:
Name Type Description
imageName string

Name of the image in resources

attrs Object

Attribute object

Properties:
Name Type Description
img Image

Image to be drawn.

Source:

Extends

Methods

copy(newName) → {GameImage}

Returns copy of current instance.

Parameters:
Name Type Description
newName string

Name of the newly created instance. Names have to be unique.

Overrides:
Source:
Returns:

New instance of GameImage with the same attributes.

Type
GameImage

draw(ctx)

Transforms input context and calls draw function of passed drawable.

Parameters:
Name Type Description
ctx CanvasRenderingContext2D

Rendering context.

Overrides:
Source:

drawFunction(ctx)

Called when drawing

Parameters:
Name Type Description
ctx CanvasRenderingContext2D

Rendering context on which the method draws

Overrides:
Source:

getAttrs() → {Object}

Returns object of attributes of current instance.

Overrides:
Source:
Returns:

Attribute object.

Type
Object

setImg(imageName)

Setter for images

Parameters:
Name Type Description
imageName string

Name of image in the resource folder

Source: