February 2017
Beginner to intermediate
258 pages
5h 31m
English
We still need to add the Power-p Star into the world. We can randomly spawn a Star every ten encounters to add some extra excitement. Follow these steps to add the Star logic:
Star class as a constant on the GameScene class:let powerUpStar = Star()
GameScene didMove function, add the Star as a child of the GameScene and position it:// Place the star out of the way for now: self.addChild(powerUpStar) powerUpStar.position = CGPoint(x: -2000, y: -2000)
GameScene didSimulatePhysics function, update your new encounter code as follows (new code in bold):// Check to see if we should set a new encounter: if player.position.x ...
Read now
Unlock full access