Constructor
new GameObject(renderable) → {GameObject}
Parameters:
| Name | Type | Description |
|---|---|---|
renderable |
Renderable | the renderable to be associated with this GameObject |
- Source:
Returns:
a new instance of GameObject
- Type
- GameObject
Methods
draw(aCamera)
Draws this gameObject if it is visible the draw flags are set to true
Parameters:
| Name | Type | Description |
|---|---|---|
aCamera |
Camera | The camera |
- Source:
getBBox() → {BoundingBox}
Returns the BoundingBox for this gameObject
- Source:
Returns:
a new copy of the bounding box of this GameObject
- Type
- BoundingBox
getCurrentFrontDir() → {vec2}
Returns the front direction of this gameObject
- Source:
Returns:
mCurrentFrontDir - the current front direction of this gameObject
- Type
- vec2
getRenderable() → {Renderable}
Returns the renderable associated with this gameObject
- Source:
Returns:
mRenderComponent - the renderable associated with this gameObject
- Type
- Renderable
getRigidBody() → {RigidShape}
Returns the RigidShape of this gameObject
- Source:
Returns:
mRigidBody - the RigidShape of this gameObject
- Type
- RigidShape
getXform() → {Transform}
Returns the Transform of the Renderable associated with this GameObject
- Source:
Returns:
the Transform of this GameObject
- Type
- Transform
isVisible() → {boolean}
Returns the visibility of this gameObject
- Source:
Returns:
mVisible - the visivility of this gameObject
- Type
- boolean
pixelTouches(otherObj, wcTouchPos) → {boolean}
Determines if this GameObject has an overlapping pixel with another GameObject
Parameters:
| Name | Type | Description |
|---|---|---|
otherObj |
GameObject | the other GameObject |
wcTouchPos |
vec2 | vector to store the first world coordinates where the pixels touch |
- Source:
Returns:
whether this GameObject has a pixel overlapping otherObj
- Type
- boolean
setCurrentFrontDir(f)
Changes this gameObject's current facing direction
Parameters:
| Name | Type | Description |
|---|---|---|
f |
vec2 | vector that will be put into mCurrentFrontDir after being normalized |
- Source:
setRigidBody(r)
Sets the rigid body this gameObject will use
Parameters:
| Name | Type | Description |
|---|---|---|
r |
RigidShape | the rigid body |
- Source:
setVisibility(f)
Sets the visibility of this gameObject to true or false
Parameters:
| Name | Type | Description |
|---|---|---|
f |
boolean | boolean to set if this gameObject is visibile or not |
- Source:
toggleDrawRenderable()
Switches whether this gameObject's renderable is drawn
- Source:
toggleDrawRigidShape()
Switches whether this gameObject's rigid shape is drawn
- Source:
update()
Method called by Gameloop, updates the rigid body of this gameObject
- Source: