new SalsaStore()
Represents the salsa store in the game, which is a drawable object.
The store is displayed using an image and its x-position is randomized.
Extends
Members
height :number
The height of the salsa store.
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 salsa store.
Type:
- number
- Overrides:
- Source:
x :number
The x-coordinate of the salsa store.
Type:
- number
- Overrides:
- Source:
y :number
The y-coordinate of the salsa store.
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:
reset()
Resets the salsa store's x-position by randomizing it within a specified range.