O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — implementing explosions

To implement explosions follow the ensuing steps:

  1. Create a new script and save it under the name explosionClass.monkey.
  2. Again, switch into Strict mode, import gameClasses, and create a global list called explosions, to store each explosion created in it.
    Strict
    Import gameClasses
    Global explosions := New List<explosion>
    

    Just like with the other objects before, we need some wrapper functions, which we can implement into the RocketCommander class. Only the names of the functions are different, so you already now how they work.

  3. Implement functions to create, update, render, and remove explosions.
    Function UpdateExplosions:Int() For Local explosion := Eachin explosions explosion.Update() Next Return True End ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required