Game Development Reference
In-Depth Information
Locate the
loadLevelNamed:
method in the same class, and insert the highlighted line
Listing 4-8
.
Add the highlighted line to the loadLevelNamed: method
_physicsNode = (CCPhysicsNode*)[_levelNode
getChildByName:@"physics"
recursively:NO];
_physicsNode.debugDraw = _drawPhysicsShapes;
So...where to set this ivar's value? In SpriteBuilder, of course. Open the
GameS-
cene.ccb
and select its root node in the Timeline. On the Item Properties tab, click the
Edit Custom Properties button. Add a property of the same name as the
_drawPhysic-
Figure 4-12
.
Add a custom property to toggle physics debug drawing on or off
Now you can publish, build, and run to see what physics debug drawing does. Or allow
me to direct your attention to
Figure 4-13
, which provides an example.
Search WWH ::
Custom Search