Testing the new game objects

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 bee. 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) ...

Get Swift Game Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.