Constructor
new ExplosionParticle(game, explosion, id)
Create an individual particle instance
Parameters:
Name | Type | Description |
---|---|---|
game |
SpaceInvaders | The current game |
explosion |
Explosion | The explosion this particle is in |
id |
string | Unique DOM element id |
Properties:
Name | Type | Description |
---|---|---|
game |
SpaceInvaders | The current game |
explosion |
Explosion | The explosion this particle is in |
width |
number | Width of this particle |
height |
number | Width of this particle |
posX |
number | Position on screen |
posY |
number | Position on screen |
velocity |
number | Speed of particle |
direction |
number | Direction of particle (angle from North) |
opacity |
number | DOM element opacity (fade out) |
isActive |
boolean | Is this particle still active / alive |
domElement |
Object | The DOM element for this particle |
- Source:
Methods
draw()
Update the dom element to show it on screen.
- Source:
update()
Main particle update loop, move, fade and die
- Source: