Class: BackgroundObjekt

BackgroundObjekt()

new BackgroundObjekt()

Represents a background object that extends the DrawableObject.
Source:

Extends

Members

height :number

The height of the background object.
Type:
  • number
Overrides:
Source:

imageCache :Object.<string, HTMLImageElement>

A cache for storing images, with the image path as the key.
Type:
  • Object.<string, HTMLImageElement>
Inherited From:
Source:

img :HTMLImageElement

The image used for the drawable object.
Type:
  • HTMLImageElement
Inherited From:
Source:

offset :Object

Offset values for adjusting collision detection or rendering.
Type:
  • Object
Inherited From:
Source:

width :number

The width of the background object.
Type:
  • number
Overrides:
Source:

x :number

The x-coordinate position of the background object.
Type:
  • number
Overrides:
Source:

y :number

The y-coordinate position of the background object. This positions the object at the bottom of the canvas.
Type:
  • number
Overrides:
Source:

Methods

draw(ctx)

Draws the current image on the provided canvas context.
Parameters:
Name Type Description
ctx CanvasRenderingContext2D The drawing context of a canvas.
Inherited From:
Source:

loadImage(path)

Loads a single image from the specified path.
Parameters:
Name Type Description
path string The path of the image to load.
Inherited From:
Source:

loadImages(arr)

Loads multiple images and stores them in the image cache.
Parameters:
Name Type Description
arr Array.<string> An array of image paths.
Inherited From:
Source:

BackgroundObjekt(imagePath, x)

new BackgroundObjekt(imagePath, x)

Creates an instance of BackgroundObjekt.
Parameters:
Name Type Description
imagePath string The path to the image to load.
x number The x-coordinate position for the background object.
Source:

Members

height :number

The height of the background object.
Type:
  • number
Overrides:
Source:

imageCache :Object.<string, HTMLImageElement>

A cache for storing images, with the image path as the key.
Type:
  • Object.<string, HTMLImageElement>
Inherited From:
Source:

img :HTMLImageElement

The image used for the drawable object.
Type:
  • HTMLImageElement
Inherited From:
Source:

offset :Object

Offset values for adjusting collision detection or rendering.
Type:
  • Object
Inherited From:
Source:

width :number

The width of the background object.
Type:
  • number
Overrides:
Source:

x :number

The x-coordinate position of the background object.
Type:
  • number
Overrides:
Source:

y :number

The y-coordinate position of the background object. This positions the object at the bottom of the canvas.
Type:
  • number
Overrides:
Source:

Methods

draw(ctx)

Draws the current image on the provided canvas context.
Parameters:
Name Type Description
ctx CanvasRenderingContext2D The drawing context of a canvas.
Inherited From:
Source:

loadImage(path)

Loads a single image from the specified path.
Parameters:
Name Type Description
path string The path of the image to load.
Inherited From:
Source:

loadImages(arr)

Loads multiple images and stores them in the image cache.
Parameters:
Name Type Description
arr Array.<string> An array of image paths.
Inherited From:
Source: