Game Development Reference
In-Depth Information
Last, edit the doughnut's polygon shape to approximately match the doughnut's outline,
but try to use no more than eight points or so. The doughnut doesn't need to have a very
precise collision shape. Something like the one shown in
Figure 4-15
absolutely suffices.
Figure 4-15
.
This is not an exit. Well, not yet
Then switch over to the
Player.ccb
, select the player sprite, and switch to the Item
Physics tab. Here you need to enter
player
in the “Collision type” field. Also, check that
both
Categories
and
Masks
fields are empty here as well.
The last thing to do in SpriteBuilder before you'll write some code is to open the
Level1.ccb
and drag and drop the
Exit1
node from the
Tileless Editor
onto
the
CCPhysicsNode
in the Timeline. The
Exit1
doughnut needs to be a child node of
the
CCPhysicsNode
. This is important; if it isn't, the exit node's physics behavior, in-
cluding collisions, will not work.
You can then freely rotate and position the exit doughnut where you want it to be, nor-
mally somewhere near the right end of the level. However, for testing it may be a better
idea to position it in the vicinity of the player to be able to test the upcoming code more
quickly. You can later move it into its intended place.
Implementing the Exit Collision Callback
Search WWH ::
Custom Search