API Docs for: 0.1.0
Show:

CG.Entity Class

Extends CG.Class
Module: CG

CG.Entity the base class of Cangaja


                               var e = new CG.Entity({
                                  name: 'player',
                                  position: new CG.Point(100,100)
                                })
                        

Methods

AABB

() Object

returns the bounds of rotated rectangle

Returns:

Object:

returns the calculated bounds

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?

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

setImage

(
  • image
)

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

Parameters:

  • image Image

    image path, image or atlasimage

Properties

boundingradius

Number

clicked

Boolean

dragable

Boolean

height

Number

mapcollision

Boolean

rotation

Number

transform

Transform

Transform object for matrix transformation

visible

Boolean

visibility option

xhandle

Number

xscale

Number

yhandle

Number

yscale

Number