The only task of this class will be to create a new emitter and add it to the emitter list of our game
class:
1. Add a new method called
SpawnEmitter
to thegame
class. Its parameters are the position, a time factor, and thekind
flag.Method SpawnEmitter:Int (x:Float,y:Float,t:Float,k:Int=0)
2. Add a new instance of the
ParticleEmitter
class to theemitterList
. Then, close this method:emitterList.AddLast(New ParticleEmitter(x,y,t,k)) Return 0 End
Now, we are able to create emitters whenever and wherever we want. They will spit out particles for as long as we tell them to. Updating the emitters will be done inside the heart of our game, the engine
class.
When you spawn particles later in the game, they will look like the following screenshot: