LayeredSprite

new LayeredSprite(sprites)

Create a new sprite partition.
Parameters:
NameTypeDescription
spritesArray.<SpritePartition>Sprite partitions to draw

Members

height

Get the height of the sprite.

width

Get the width of the sprite.

Methods

draw(ctx, pos, size)

Draw the sprite.
Parameters:
NameTypeDefaultDescription
ctxCanvasRenderingContext2D
posVec2Position/offset to draw sprite at
sizeVec2 | nullnullCustom size of drawn sprite (or null to use default)

update(elapsed)

Update the sprite.
Parameters:
NameTypeDescription
elapsednumberTime since last update cycle in seconds