API Docs for: 0.1.0
Show:

CG.Emitter Class

Extends CG.Entity
Module: CG

CG.Emitter that handles . . . particles.


                        var e = new CG.Emitter({
                          position: new CG.Point(100,100)
                        })
                        

Methods

AABB

() Object

returns the bounds of rotated rectangle

Returns:

Object:

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 Array

    a array of objects to check for collision => Sprites, Animations, MapAreas

  • callback Callback

    what to do after collision?

createParticle

()

Returns:

:

deactivateFadeout

()

Deactivate fadeout of the particles depending on lifetime

draw

()

getRandom

(
  • min
  • max
)

Parameters:

  • min Mixed

    value for random number

  • max Mixed

    value for random number

getX

()

getY

()

ifClicked

() True/false

checks click inside of the rectangle, supports rotation

Returns:

True/false:

ifMouseOver

()

checks if the mouse/pointer is over the rectangle

init

(
  • options
)

Options: name {string} position {CG.Point}

Parameters:

  • options Object

    the name of the Entity

init!~YUIDOC_LINE~!!~YUIDOC_LINE~!Options:!~YUIDOC_LINE~!position

(
  • position
)

Parameters:

Returns:

:

initAsCorona

(
  • image
  • radius
)

Parameters:

  • image Mixed

    path, image or atlasimage to use for the particle

  • radius Number

    of the corona emitter

initAsExplosion

(
  • image
  • min
  • max
)

Parameters:

  • image Mixed

    path, image or atlasimage to use for the particle

  • min Number

    value for particle speed

  • max Number

    value for particle speed

initAsLine

(
  • image
  • width
  • direction
)

Parameters:

  • image Mixed

    path, image or atlasimage to use for the particle

  • width Number

    of the plate emitter

  • direction Number

    (defined constants) of the plate emitter

initAsPoint

(
  • image
)

Parameters:

  • image Mixed

    path, image or atlasimage to use for the particle

initAsRectangle

(
  • image
  • width
  • height
)

Parameters:

  • image Mixed

    path, image or atlasimage to use for the particle

  • width Number

    of the plate emitter

  • height Number

    (defined constants) of the plate emitter

initParticle

(
  • particle
)

Parameters:

  • particle Particle

    particle object

searchInvisibleParticle

()

Each emitter has its own particle pool to prevent object deletion/creation. This method searches an inactive/invisible particle

setCreationTime

(
  • creationtime
)

Parameters:

setEmitterPosition

(
  • position
)

Parameters:

setGravity

(
  • gravity
)

Parameters:

  • gravity Float

    for all emitter controlled particles

setImage

(
  • image
)

initialize image for object. for now => sprite, particle, buffer, bitmap and button use it

Parameters:

  • image Image

    image path, image or atlasimage

setMaxParticles

(
  • maxparticle
)

Parameters:

setName

(
  • name
)

Parameters:

  • name String

    of the object for search with layerobject.getElementByName(name)

setParticleSpeed

(
  • speed
)

Parameters:

  • speed Number

    set the speed of the particles

setPLifetime

(
  • plifetime
)

Parameters:

  • plifetime Number

    set the lifetime of the particles

setProtation

(
  • rotation
)

Parameters:

  • rotation Mixed

    set the rotation of the particles

update

()

Properties

boundingradius

Number

clicked

Boolean

creationspeed

Number

creationtime

Number

currenttime

Number

dragable

Boolean

height

Number

Inherited from CG.Entity but overwritten in cangaja/control/emitter.js:90

image

Null

mapcollision

Boolean

maxparticles

Number

particle

Array

pdirection

Number

plifetime

Number

protation

Number

rotation

Number

Inherited from CG.Entity but overwritten in cangaja/control/emitter.js:80

transform

Transform

Transform object for matrix transformation

visible

Boolean

visibility option

width

Number

Inherited from CG.Entity but overwritten in cangaja/control/emitter.js:85

xhandle

Number

xscale

Number

yhandle

Number

yscale

Number