September 2018
Intermediate to advanced
434 pages
8h 47m
English
Now that we have assigned the physics categories to our game objects, we can monitor for contact events in the GameScene class. Follow these steps to wire up the GameScene class:
GameScene class to implement the SKPhysicsContactDelegate protocol. SpriteKit can then inform the GameScene class when contact events occur. Change the GameScene class declaration line to look like this: class GameScene: SKScene, SKPhysicsContactDelegate { GameScene of contact events by setting the GameScene physicsWorld contactDelegate property to the GameScene instance. At the bottom of the GameScene didMove function, add this line:self.physicsWorld.contactDelegate = self ...
Read now
Unlock full access