CG.Emitter Class
CG.Emitter that handles . . . particles.
var e = new CG.Emitter({
position: new CG.Point(100,100)
})
Item Index
Methods
- AABB
- activateFadeout
- checkCollision
- createParticle
- deactivateFadeout
- draw
- getRandom
- getX
- getY
- ifClicked
- ifMouseOver
- init
- init!~YUIDOC_LINE~!!~YUIDOC_LINE~!Options:!~YUIDOC_LINE~!position
- initAsCorona
- initAsExplosion
- initAsLine
- initAsPoint
- initAsRectangle
- initParticle
- searchInvisibleParticle
- setCreationTime
- setEmitterPosition
- setGravity
- setImage
- setMaxParticles
- setName
- setParticleSpeed
- setPLifetime
- setProtation
- update
Methods
AABB
()
Object
returns the bounds of rotated rectangle
Returns:
returns the calculated bounds
activateFadeout
()
Activate fadeout of the particles depending on lifetime
checkCollision
-
objects
-
callback
checks if there is a collision of the given objects to this object http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
Parameters:
-
objects
Arraya array of objects to check for collision => Sprites, Animations, MapAreas
-
callback
Callbackwhat to do after collision?
createParticle
()
Returns:
deactivateFadeout
()
Deactivate fadeout of the particles depending on lifetime
draw
()
getRandom
-
min
-
max
Parameters:
-
min
Mixedvalue for random number
-
max
Mixedvalue for random number
getX
()
getY
()
ifClicked
()
True/false
checks click inside of the rectangle, supports rotation
Returns:
ifMouseOver
()
checks if the mouse/pointer is over the rectangle
init
-
options
Options: name {string} position {CG.Point}
Parameters:
-
options
Objectthe name of the Entity
init!~YUIDOC_LINE~!!~YUIDOC_LINE~!Options:!~YUIDOC_LINE~!position
-
position
Parameters:
-
position
CG.Point
Returns:
initAsCorona
-
image
-
radius
Parameters:
-
image
Mixedpath, image or atlasimage to use for the particle
-
radius
Numberof the corona emitter
initAsExplosion
-
image
-
min
-
max
initAsLine
-
image
-
width
-
direction
initAsPoint
-
image
Parameters:
-
image
Mixedpath, image or atlasimage to use for the particle
initAsRectangle
-
image
-
width
-
height
initParticle
-
particle
Parameters:
-
particle
Particleparticle object
searchInvisibleParticle
()
Each emitter has its own particle pool to prevent object deletion/creation. This method searches an inactive/invisible particle
setGravity
-
gravity
Parameters:
-
gravity
Floatfor all emitter controlled particles
setImage
-
image
initialize image for object. for now => sprite, particle, buffer, bitmap and button use it
Parameters:
-
image
Imageimage path, image or atlasimage
setName
-
name
Parameters:
-
name
Stringof the object for search with layerobject.getElementByName(name)
setProtation
-
rotation
Parameters:
-
rotation
Mixedset the rotation of the particles
update
()
Properties
image
Null
transform
Transform
Transform object for matrix transformation