Class: YouWon

YouWon()

new YouWon()

Represents the victory screen displayed when the player wins. Extends the DrawableObject class.
Source:

Extends

Members

height :number

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

x :number

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

y :number

The y-coordinate of the victory 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:

YouWon()

new YouWon()

Creates a new YouWon instance. Loads the victory screen image and positions it at the top-left corner.
Source:

Members

height :number

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

x :number

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

y :number

The y-coordinate of the victory 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: