Constructor
new ExplosionFactory(eWidth, eHeight, countStop, spriteSheetX, spriteSheetY, poolAmountopt)
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
eWidth |
Number | The default explosion width. |
||
eHeight |
Number | The defauly explosion height. |
||
countStop |
Number | The default explosion frame amount. |
||
spriteSheetX |
Number | The default x position in the sprite sheet to draw from. |
||
spriteSheetY |
Number | The default y position in the sprit sheet to draw from. |
||
poolAmount |
Number |
<optional> |
51 | The amount of explosions to pool. Default is 51. |
Members
constructor
Methods
addExplosion(ex, ey, ecount, fromX, fromY, width, height, throttle)
Add an explosion to be displayed. ex and ey must be defined, the other values will default to what was set during construction.
call displayExplosions to display each added explosion.
Name | Type | Description |
---|---|---|
ex |
Number | The x location to display the explosion |
ey |
Number | The y location to display the explosion. |
ecount |
Number | the frame to start from, when it reaches countStop (defined during construction) the animation stops. Default is 1. |
fromX |
Number | the x location to draw from the sprite sheet, will default to what was defined during construction. |
fromY |
Number | the y location to draw from the sprite sheet, will default to what was defined during construction. |
width |
Number | the width of the animation |
height |
Number | the height of the animation. |
throttle |
Number | Speed of the animation, default is 1. |
displayExplosions(canvasObject, source)
Displays the addeded explosions onto the CanvasObject given, using the image source given. This method should be called during a loop.
Name | Type | Description |
---|---|---|
canvasObject |
CanvasObject | The CanvasObject to draw to. |
source |
Image | The sprite sheet to draw from, an image. |