Game Development Reference
In-Depth Information
Figure 4-1
.
The modified scene with additional orbs
The last thing that needs to be done before adding the scrolling to the game is to change
how orb contacts are handled. If you remember from the previous chapter, whenever the
playerNode
came into contact with an
orbNode
, the
orbNode
was removed from
the scene. This is still going to happen, but now the contact is going to also increment the
impuleCount
variable, giving the player additional impulses. To do this, change the
current
didBeginContact()
method to the following:
func didBeginContact(contact: SKPhysicsContact!) {
var nodeB = contact!.bodyB!.node!
if nodeB.name == "POWER_UP_ORB" {
impulseCount++