Constructor#
new Sprite(image, width, height)#
Create a new sprite.
Parameters:
Name | Type | Description |
---|---|---|
image | HTMLImageElement | Image to use for drawing |
width | number | Width of image |
height | number | Height of image |
- Source
Members#
height#
Get the height of the sprite.
- Source
image#
Get the image for the sprite.
- Source
width#
Get the width of the sprite.
- Source
Methods#
draw(ctx, pos, size)#
Draw the sprite.
Parameters:
- Source
update(elapsed)#
Update the sprite.
Parameters:
Name | Type | Description |
---|---|---|
elapsed | number | Time since last update cycle in seconds |
- Source