Game Development Reference
In-Depth Information
}
if contact.nodeB.physicsBody!.categoryBitMask ==
CollisionCategoryObstacles {
println("OUCH HIT Obstacle!-------")
}
}
At this time you are just going to print a line when you hit either the enemy or an obstacle.
So, run your game at this time and move the spaceman around the playing field. As you
keep an eye on the console logs, notice that when you run into an obstacle or the enemy,
the appropriate line is output.
Summary
In this chapter, you have done a lot to get the spaceman moving. You also have the space-
man colliding with objects instead of going through them. At this point, you are almost
finished with the hide-and-seek game.
In the next chapter, you will use this collision protocol to update the score. This score-
board that you will create will be in a Sprite Kit view. This way, you can see how to com-
bine a Sprite Kit view with in a Scene Kit scene.
Search WWH ::




Custom Search