Game Development Reference
In-Depth Information
There are two remaining problems with the player as of now. Thanks to the circumference
bodies, the actual collision shape of the player has become larger—by about the radius of
the circumference body's circle shape. The other problem relates to the texture. As of
now, the positions of the circumference nodes determine the texture coordinates. Since the
circumference nodes are somewhat inside the player, the player's outer shape seems cut
off.
Both issues are visible in
Figure 10-13
.
For one, you'll notice the rather large distance
between the player and the gear spokes, despite the player being squeezed in between two
spokes. The other problem is that some of the player's curly hair is cut off, as is its round
belly shape. Compare it with
Figure 10-3
.
Figure 10-13
.
The player is drawn too small for its collision shape, and its curly hair is cut off
Let's fix these problems. Open
PlayerSoftBody.ccb
, and select the root node. On the
Item
Properties
tab, click the
Edit Custom Properties
button at the bottom. Add two custom
properties of type
float
, named
_enlargeDrawRadius
and
_enlargeTex-
tureRadius
. Both are already declared and in use by the
SoftBodyDrawNode
class.
Leave both values at
0
for the moment.
Now disable physics debug drawing for a second. Open
GameScene.ccb
, select the root
node, and set the
_drawPhysicsShapes
property to
0
. Then run the game, and try to
focus on the player's texture. If you look closely enough in the game, you'll notice the
player's texture has a noticeable octagonal shape with parts of it cut off, as in
Figure
Search WWH ::
Custom Search