new ParticleSystem(texture, xPos, yPos, width, yAcceleration, life, xVelocity, yVelocity, flicker, intensity, xAcceleration, size, yOffset, startColor, finalColor, yMultiplier) → {ParticleSystem}
Default Constructor
Parameters:
Name | Type | Description |
---|---|---|
texture |
String | The particle texture |
xPos |
float | The x position for the ParticleSystem |
yPos |
float | The y position for the ParticleSystem |
width |
float | The maximum horizontal offset for the particles |
yAcceleration |
float | The vertical acceleration for the paritcles |
life |
float | The life for the particles |
xVelocity |
float | The initial horizontal boost for the particles |
yVelocity |
float | The initial vertical boost for the particles |
flicker |
float | How quickly particles shrink |
intensity |
float | The number of ParticleSystem particles created per update cycle |
xAcceleration |
float | The horizontal acceleration for the paritcles |
size |
float | The size for the paritcles |
yOffset |
float | The maximum vertical offset for the paritcles |
startColor |
Array.<Array> | The beginning color for the particles |
finalColor |
Array.<Array> | The final color for the particles |
yMultiplier |
float | The number y variables will be multiplied by |
Returns:
New instance of object
- Type
- ParticleSystem
Methods
createParticle(atX, atY) → {Paritcle}
The function for creating particles (needs to be overrided to be used)
Parameters:
Name | Type | Description |
---|---|---|
atX |
int | the base xPos for the particle |
atY |
int | the base yPos for the particle |
Returns:
p the particle created
- Type
- Paritcle
draw(aCamera)
Draws the particles on the camera passed in the argument
Parameters:
Name | Type | Description |
---|---|---|
aCamera |
Camera | the camera to be viewed on |
getFinalColor() → {Array.<Array>}
Returns the final color of the particles
Returns:
this.finalColor
- Type
- Array.<Array>
getFlicker() → {float}
Get the rate that the particles are fading
Returns:
this.flicker
- Type
- float
getIntensity() → {float}
Get the number of particles created per update cycle
Returns:
this.intensity
- Type
- float
getLife() → {float}
Increase the life of the particles
Returns:
this.life
- Type
- float
getParticleSize() → {float}
Get the size of the particles
Returns:
this.size
- Type
- float
getPos() → {Array.<Float>}
A function to return the the location of the base of the ParticleSystem
Returns:
The x and y position of the ParticleSystem
- Type
- Array.<Float>
getSizeBase() → {float}
Returns the base number for caluclating size
Returns:
this.sizeBase
- Type
- float
getStartColor() → {Array.<Array>}
Return the initial color of the particles
Returns:
this.startColor
- Type
- Array.<Array>
getWidth() → {float}
Get the width of the ParticleSystem object
Returns:
this.width
- Type
- float
getxAcceleration() → {float}
Get the xAcceleration of the particles
Returns:
this.xAcceleration
- Type
- float
getxVelocity() → {float}
Get the x velocity of the particles
Returns:
this.xVelocity
- Type
- float
getyAcceleration() → {float}
Get the yAcceleration of the particles
Returns:
this.yAcceleration
- Type
- float
getyMultiplier() → {float}
Return the yMultiplier of the ParticleSystem Object
Returns:
this.yMultiplier
- Type
- float
getyOffset() → {float}
Get the yOffset of the particles
Returns:
this.yOffset
- Type
- float
getyVelocity() → {float}
Get the y velocity of the particles
Returns:
this.yVelocity
- Type
- float
incFlicker(inc)
Increases the rate of the particles fading
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incIntensity(inc)
Increase the intensity (number of particles created per update cycle) of the ParticleSystem object
necessary to increase as you increase the width or height of the ParticleSystem object
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incLife(inc)
Increase the lifespan of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incParticleSize(inc)
Increase the size of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incWidth(inc)
Increase the width of the ParticleSystem object
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incxAcceleration(inc)
Increase the xAcceleration of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incxVelocity(inc)
Increase the x velocity of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incyAcceleration(inc)
Increase the yAcceleration of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incyOffset(inc)
Increase the yOffset of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
incyVelocity(inc)
Increase the y velocity of the particles
Parameters:
Name | Type | Description |
---|---|---|
inc |
float | how much to increment by |
processCollision(objSet)
Handles collsision for all particles in regards the all objects in the passed set
Parameters:
Name | Type | Description |
---|---|---|
objSet |
ObjSet | the GameObjectSet to check for collision |
setFinalColor(color)
Set the final color of the particles
Parameters:
Name | Type | Description |
---|---|---|
color |
Array.<Array> | The new final color |
setFlicker(flicker)
Sets the flicker to the passed number
Parameters:
Name | Type | Description |
---|---|---|
flicker |
float | The number to set the shrinking rate to |
setIntensity(intensity)
Sets the intensity to the passed number
Parameters:
Name | Type | Description |
---|---|---|
intensity |
float | The number to set the intensity to |
setLife(life)
Sets the life to the passed number
Parameters:
Name | Type | Description |
---|---|---|
life |
float | The number to set the life to |
setPos(xPos, yPos)
Set the position of the ParticleSystem Object
Parameters:
Name | Type | Description |
---|---|---|
xPos |
float | The x position |
yPos |
float | They y position |
setSize(size)
Sets the size to the passed number
Parameters:
Name | Type | Description |
---|---|---|
size |
float | The number to set the size to |
setSizeBase(num)
Set the base size number
Parameters:
Name | Type | Description |
---|---|---|
num |
float | The new size base |
setStartColor(color)
Set the start color of the particles
Parameters:
Name | Type | Description |
---|---|---|
color |
Array.<Array> | The new start color |
setWidth(width)
Sets the width to the passed number
Parameters:
Name | Type | Description |
---|---|---|
width |
float | The number to set the width to |
setxAcceleration(xAcceleration)
Sets the xAcceleration to the passed number
Parameters:
Name | Type | Description |
---|---|---|
xAcceleration |
float | The number to set the xAcceleration to |
setxVelocity(xVelocity)
Sets the xVelocity to the passed number
Parameters:
Name | Type | Description |
---|---|---|
xVelocity |
float | The number to set the xVelocity to |
setyAcceleration(yAcceleration)
Sets the yAcceleration to the passed number
Parameters:
Name | Type | Description |
---|---|---|
yAcceleration |
float | The number to set the yAcceleration to |
setyMultiplier(num)
Set the yMultiplier for the ParticleSystem object
Parameters:
Name | Type | Description |
---|---|---|
num |
float | The new yMultiplier |
setyOffset(yOffset)
Sets the yOffset to the passed number
Parameters:
Name | Type | Description |
---|---|---|
yOffset |
float | The number to set the yOffset to |
setyVelocity(yVelocity)
Sets the yVelocity to the passed number
Parameters:
Name | Type | Description |
---|---|---|
yVelocity |
float | The number to set the yVelocity to |
update()
Creates new particles and updates them