Game Development Reference
In-Depth Information
Locate the loadLevelNamed: method in the same class, and insert the highlighted line
in Listing 4-8 after the _physicsNode is assigned.
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-
sShapes ivar, but this time use Bool as the type and set its value to 1, as seen in Figure
4-12 .
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