new FilledRect(name, width, height, fillStyle)
A filled rectangle that can be used like a sprite
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the rectangle sprite |
width |
Number | the width of the rectangle |
height |
Number | the height of the rectangle |
fillStyle |
String | the fill style of the rectangle |
- Implements:
- Source:
Methods
constructor(name, width, height, fillStyle)
Constructor method
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the rectangle sprite |
width |
Number | the width of the rectangle |
height |
Number | the height of the rectangle |
fillStyle |
String | the fill style of the rectangle |
- Implements:
- Source:
draw(context, x, y)
Draws the sprite based on the angle and sprite sheet chosen. Do not override this function.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
RenderingContext | the context |
x |
Number | the x position on the canvas |
y |
Number | the y position on the canvas |
- Implements:
- Source: