Class AnimatedGameObject
Defined in: AnimatedGameObject.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Displays an animated Game Object
|
Field Attributes | Field Name and Description |
---|---|
Defines the current frame that is to be rendered
|
|
The width of each individual frame
|
|
Defines the frames per second of the animation
|
|
Time until the next frame
|
Method Attributes | Method Name and Description |
---|---|
draw(dt, context, xScroll, yScroll)
Draws this element to the back buffer
|
|
startupAnimatedGameObject(image, x, y, z, frameCount, fps)
Initialises this object
|
Field Detail
{Number}
currentFrame
Defines the current frame that is to be rendered
{Number}
frameWidth
The width of each individual frame
{Number}
timeBetweenFrames
Defines the frames per second of the animation
{number}
timeSinceLastFrame
Time until the next frame
Method Detail
draw(dt, context, xScroll, yScroll)
Draws this element to the back buffer
- Parameters:
- {Number} dt
- Time in seconds since the last frame
- {CanvasRenderingContext2D} context
- The context to draw to
- {Number} xScroll
- The global scrolling value of the x axis
- {Number} yScroll
- The global scrolling value of the y axis
startupAnimatedGameObject(image, x, y, z, frameCount, fps)
Initialises this object
- Parameters:
- {Image} image
- The image to be displayed
- {Number} x
- The position on the X axis
- {Number} y
- The position on the Y axis
- {Number} z
- The depth
- {Number} frameCount
- The number of animation frames in the image
- {Number} fps
- The frames per second to animate this object at