O'Reilly logo

Swift 3 Game Development - Second Edition by Stephen Haney

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spawning endless encounters

We need at least three encounters to endlessly cycle and create a never-ending world; two can be on the screen at any one time and a third positioned ahead of the player. We can track Pierre's progress and reposition the encounter nodes ahead of him.

Building more encounters

We need to build at least two more encounters before we can implement the repositioning system. You can create more if you like; the system will support any number of encounters. For now, add two more SpriteKit Scene files to your game: EncounterB.sks and EncounterC.sks. Resize these scenes to 900 wide by 600 tall, like EncounterA. You can fill these encounters with bees, blades, coins, and bats - have fun! Make sure to assign the custom class attribute ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required