Class: TiledGameObject

TiledGameObject(renderableObj) → {TiledGameObject}

Support for repeating renderable tiles, infinitely tileable. Assumes X/Y alignments.

Found in Chapter 11, page 674 of the textbook

Example: 11.1 Tiled Objects

Constructor

new TiledGameObject(renderableObj) → {TiledGameObject}

Parameters:
Name Type Description
renderableObj Renderable the Renderable associated with this TiledGameObject
Source:
Returns:
a new TileGameObject instance
Type
TiledGameObject

Extends

Methods

_drawTile(aCamera)

Draws a grid of tiles filling every available space within the Camera
Parameters:
Name Type Description
aCamera Camera the Camera to draw to
Source:

draw(aCamera)

Draws this TiledGameObject if visible and executes tiling if it should tile
Parameters:
Name Type Description
aCamera Camera the Camera to draw to
Overrides:
Source:

getBBox() → {BoundingBox}

Returns the BoundingBox for this gameObject
Inherited From:
Source:
Returns:
a new copy of the bounding box of this GameObject
Type
BoundingBox

getCurrentFrontDir() → {vec2}

Returns the front direction of this gameObject
Inherited From:
Source:
Returns:
mCurrentFrontDir - the current front direction of this gameObject
Type
vec2

getRenderable() → {Renderable}

Returns the renderable associated with this gameObject
Inherited From:
Source:
Returns:
mRenderComponent - the renderable associated with this gameObject
Type
Renderable

getRigidBody() → {RigidShape}

Returns the RigidShape of this gameObject
Inherited From:
Source:
Returns:
mRigidBody - the RigidShape of this gameObject
Type
RigidShape

getXform() → {Transform}

Returns the Transform of the Renderable associated with this GameObject
Inherited From:
Source:
Returns:
the Transform of this GameObject
Type
Transform

isVisible() → {boolean}

Returns the visibility of this gameObject
Inherited From:
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
Inherited From:
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
Inherited From:
Source:

setIsTiled(t)

Set the tiling property to true or false
Parameters:
Name Type Description
t boolean the tiling state
Source:

setRigidBody(r)

Sets the rigid body this gameObject will use
Parameters:
Name Type Description
r RigidShape the rigid body
Inherited From:
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
Inherited From:
Source:

shouldTile() → {boolean}

Returns whether or not tiling is active for this TiledGameObject
Source:
Returns:
mShouldTile - true if tiling is active
Type
boolean

toggleDrawRenderable()

Switches whether this gameObject's renderable is drawn
Inherited From:
Source:

toggleDrawRigidShape()

Switches whether this gameObject's rigid shape is drawn
Inherited From:
Source:

update()

Method called by Gameloop, updates the rigid body of this gameObject
Inherited From:
Source: