CG.Entity Class
CG.Entity the base class of Cangaja
var e = new CG.Entity({
name: 'player',
position: new CG.Point(100,100)
})
Item Index
Methods
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
Arraya array of objects to check for collision => Sprites, Animations, MapAreas
-
callback
Callbackwhat 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
Objectthe name of the Entity
setImage
(
-
image
initialize image for object. for now => sprite, particle, buffer, bitmap and button use it
Parameters:
-
image
Imageimage path, image or atlasimage