Class: BackgroundObject

BackgroundObject(imagePath, x)

BackgroundObject Represents a background object in the game, such as mountains or sky. Extends the MovableObject class and is rendered at a fixed vertical position.

Constructor

new BackgroundObject(imagePath, x)

Creates a new background object with an image and horizontal position.
Parameters:
Name Type Description
imagePath string Path to the background image.
x number X position of the object in the game world.
Source:

Members

height :number

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

width :number

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

x :number

The horizontal position of the background object in the game world.
Type:
  • number
Source:

y :number

The vertical position of the background object. Calculated based on the object's height to anchor it at the bottom of the screen.
Type:
  • number
Source: