Constructor
new BackgroundScene(options)
Create a new BackgroundScene with the specified options.
Parameters:
Name | Type | Description |
---|---|---|
options |
object | The options for the BackgroundScene, composed of the properties. |
Properties:
Name | Type | Description |
---|---|---|
offsetX |
integer | The offset x-coordinate in the asset in pixels (optional, default 0) |
offsetY |
integer | The offset y-coordinate in the asset in pixels (optional, default 0) |
width |
integer | The width in pixels (optional, default asset width) |
height |
integer | The height in pixels (optional, default asset height) |
- Source:
Example
Create a new BackgroundScene from an Asset
var mainMapBackgroundAsset = new Asset({ name: 'mainMapBackgroundAsset', src: 'assets/mainmap_background.png' })
var scene = new BackgroundScene({ asset: mainMapBackgroundAsset, x: 0, y: 0 })
Extends
Methods
draw(context)
Draw the BackgroundScene into the given context.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D | The context in which to draw |
- Overrides:
- Source:
redraw()
Mark this scene to be redran.
- Overrides:
- Source: