Time for action — spawning a particle emitter

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 the game class. Its parameters are the position, a time factor, and the kind flag.
    Method SpawnEmitter:Int (x:Float,y:Float,t:Float,k:Int=0)
    
  2. Add a new instance of the ParticleEmitter class to the emitterList. Then, close this method:
    emitterList.AddLast(New ParticleEmitter(x,y,t,k))
    Return 0
    End
    

What just happened?

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:

What just happened?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.218.157