Class: GameOver

GameOver()

new GameOver()

Represents the game over screen displayed when the player loses. Extends the DrawableObject class.
Source:

Extends

Members

height :number

The height of the game over screen.
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 game over screen.
Type:
  • number
Overrides:
Source:

x :number

The x-coordinate of the game over screen.
Type:
  • number
Overrides:
Source:

y :number

The y-coordinate of the game over screen.
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:

GameOver()

new GameOver()

Creates a new GameOver instance. Loads the game over image and sets its position to the top-left corner.
Source:

Members

height :number

The height of the game over screen.
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 game over screen.
Type:
  • number
Overrides:
Source:

x :number

The x-coordinate of the game over screen.
Type:
  • number
Overrides:
Source:

y :number

The y-coordinate of the game over screen.
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: