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 the rocket launchers

As you will see yourself, quite a few things look similar to the city class definition and its wrapper functions. However, the launchers are different objects, and so we need different methods and functions for them. Not every step of code is explained now, as some is the same as for the city class.

  1. Create an empty script and save it under the name launcherClass.monkey.
  2. At the beginning of the script, tell Monkey to switch into Strict mode and import the gameClasses.monkey file.
    Strict
    Import gameClasses
    
  3. Create a new list that stores all instances of the launcher class.
    Global launchers := New List<launcher>
    

    Launchers will have to be updated for each frame, so we will have a new wrapper function ...

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