Just like with the Enemy
class, we will create the emitter class in one batch:
1. Add a new class to our script, called
ParticleEmitter
. Again, this one isn't extended from anything.Class ParticleEmitter
2. Add a field for the emitter position.
Field xp:Float Field yp:Float
3. Now, insert a field for the time that is left for the emitter to create particles.
Field timeLeft:Float
4. The last field in the data section is the
kind
field. Some particles will be colored, and so we need to tell the emitter to do that.Field kind:Int
5. The
New
constructor method will have thex
andy
positions as parameters. Also it will take thetime
factor and thekind
flag as values.Method New(x:Float, y:Float, time:Int, knd:Int)
6. Set the calls fields with these values.
timeLeft = time xp = x yp = y kind = knd
7. Close the method. Even in
STRICT
mode, ourNew
method doesn't need a return value:End
8. Insert the
Update
method. The parameter will be a delta...