Game Development Reference
In-Depth Information
Figure 5-3
.
The BlackHole node added to the scene
Before moving on to performing actions on this node, the code to handle contacts between
the
playerNode
and the
blackHoleNode
needs to be added to the
GameScene
class. You have seen all of this code before. So, I will be going over it quickly without too
much explanation.
First the
categoryBitMask
of the
blackHoleNode
needs to be configured, and the
playNode
's
contactBitMask
needs to be modified to include the
black-
HoleNode
's
categoryBitMask
. To do this, add this definition of the
Colli-
sionCategoryBlackHoles
constant directly below the other two category defini-
tions, as shown here: