February 2017
Beginner to intermediate
258 pages
5h 31m
English
We do not need to create a new emitter node for every single crate in our game. Instead, we will create a small pool of emitter nodes when the game starts and reposition them when the player smashes a crate. This is a performance best practice as emitter nodes can use system resources quickly. Follow these steps to create a particle emitter node pooling system:
.swift file named ParticlePool.swift, and add the following code to your new file: import SpriteKit class ParticlePool { var cratePool:[SKEmitterNode] = [] var heartPool:[SKEmitterNode] = [] var crateIndex = 0 var heartIndex = 0 // A property to store a reference to the GameScene: ...Read now
Unlock full access