Class: Sprite

Sprite(name, width, height, src, isSpriteSheetopt, defAngleopt)

new Sprite(name, width, height, src, isSpriteSheetopt, defAngleopt)

A sprite is the image of an object
Parameters:
Name Type Attributes Default Description
name String image name
width Number image width
height Number image height
src String image source
isSpriteSheet Boolean <optional>
false if image is sprite sheet
defAngle Number <optional>
0 default image angle
Properties:
Name Type Default Description
src String image source
width Number image width
height Number image height
image Image the image
isSpriteSheet Boolean if image is sprite sheet
currentSprite Number 0 the index into the spritesheet
doDraw Boolean true whether the sprite should be drawn or not
Implements:
Source:

Methods

(static) constructor(name, width, height, src, isSpriteSheetopt, defAngleopt)

Creates the Sprite
Parameters:
Name Type Attributes Default Description
name String image name
width Number image width
height Number image height
src String image source
isSpriteSheet Boolean <optional>
false if image is sprite sheet
defAngle Number <optional>
0 default image angle
Source:

draw(context, x, y, angle)

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
angle Number the angle of the sprite
Implements:
Source: