April 2021
Beginner to intermediate
506 pages
11h 57m
English
The spawnGloop() method you added in the GameScene.swift file drops a single drop of gloop. Although that’s a great start, what you really need now is a way to drop multiple drops at specific time intervals. For that, you’ll rely on another powerful feature of SpriteKit actions: running a block of code after the action completes.
Open the GameScene.swift file. Above the spawnGloop() method, add the following new method, which you’ll use to spawn multiple drops:
| | func spawnMultipleGloops() { |
| | // Set up repeating action |
| | let wait = SKAction.wait(forDuration: TimeInterval(1.0)) |
| | let spawn = SKAction.run { [unowned self] in self.spawnGloop() } |
| | let sequence = SKAction.sequence ... |
Read now
Unlock full access