Game Development Reference
In-Depth Information
Publish the project in SpriteBuilder, and then build and run the project from Xcode. The
chains and ropes should no longer collide with borders and triggers. To verify this, place
or move a chain or rope in Level1.ccb so that it overlaps a border sprite or trigger area.
Chains and ropes should also still collide with each other. The player's collisions should
behave as they used to: being stopped by borders, being pushed by gears and killed by
saws, and being able to trigger the level exit and other trigger areas.
If something is not quite as it is supposed to be, double-check and triple-check the colli-
sion categories and masks of the nodes involved in the collision. Note that some fringe
cases have not been considered, which are most easily prevented by proper level design.
For instance, chains and ropes will collide with the exit node.
Variations of Collision Behavior
As an exercise, consider the following cases:
1.
What is necessary to allow chains and ropes to pass through each other?
2.
What if you wanted chains and ropes to collide with borders, just not trig-
gers?
3.
What if you wanted ropes to collide with ropes and you wanted chains to
collide with chains, but you also wanted to disallow ropes colliding with
chains (and vice versa)?
Here are the solutions:
1.
To allow chains and ropes to pass through each other, remove obstacle from
each chain and rope node's mask so that only player is included in their col-
lision mask. (See Table 9-2 .)
Table 9-2 . Settings to allow chains and ropes to pass
through each other
Search WWH ::




Custom Search