Class: Background

Background(ctx, ratio, width, height)

This class draws the background hill and gradient given a relative coordinate to anchor with.

Constructor

new Background(ctx, ratio, width, height)

Load background images
Parameters:
Name Type Description
ctx CanvasRenderingContext2D canvas rendering context
ratio Number scaling ratio along with background
width Number canvas width
height Number canvas height
Source:

Classes

Background

Methods

draw(user_x, user_y, scale)

If images are loaded draw the background images
Parameters:
Name Type Default Description
user_x Number 0 user view offset
user_y Number 0 user view offset
scale Number image scale
Source:

load_image(alt, src)

Load image
Parameters:
Name Type Description
alt String alternative name
src String image source
Source:

update(user_x, user_y, scale)

Called every animation frame. Does not update any internal values, simply calls draw.
Parameters:
Name Type Default Description
user_x Number 0 user view offset
user_y Number 0 user view offset
scale Number image scale
Source: