February 2017
Beginner to intermediate
258 pages
5h 31m
English
It is time to see our hard work in action. We will now add one instance of each of our new classes to the game. Note that we will remove this testing code after we are done; you may want to leave yourself a comment or extra space for easy removal. Open GameScene.swift and locate the six lines that spawn the existing bees. Add this code after the bee lines:
// Spawn a bat: let bat = Bat() bat.position = CGPoint(x: 400, y: 200) self.addChild(bat) // A blade: let blade = Blade() blade.position = CGPoint(x: 300, y: 76) self.addChild(blade) // A mad fly: let madFly = MadFly() madFly.position = CGPoint(x: 50, y: 50) self.addChild(madFly) // A bronze coin: let bronzeCoin = Coin() bronzeCoin.position = CGPoint(x: -50, y: 250) ...
Read now
Unlock full access