Time for action — spawning some engine particle FX

  1. Insert the SpawnPlayerEngine method into the game class.
    Method SpawnPlayerEngine:Int()
    
  2. Determine the position 20 pixels right behind the ship with the GetVector method.
    Local d:Float[] = player.GetVector(20,180.0+player.angle)
    
  3. Create a new object for the engine particle from the sprite atlas.
    obj = eng.CreateImage(atlas, 16,96,16,16, d[0],d[1])
    
  4. Set the angle to the ship angle, scale it down to a half, and set the layer to layerFX.
    obj.SetAngle(player.angle)
    obj.SetScale(0.5)
    obj.SetLayer(layerFX)
    
  5. To remove the trail after 100 milliseconds, call CreateObjTimer. After that, close that method.
    eng.CreateObjTimer(obj, tmObjRemove, 100)
    Return 0
    End
    

What just happened?

The method SpawnPlayerEngine creates a nice particle effect that reassembles the thrust of an engine. It also creates a timer for each particle so it will be removed after its lifetime.

And it goes boom—creating an explosion

Another source of eye candy would be the explosions when an object gets hit.

..................Content has been hidden....................

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