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 some rockets

Surely you know what you have to do now. Like all the other main objects we have created so far, each rocket will have its own class, which is located in its own file.

  1. Create a new file and save it under the name rocketClass.monkey.
  2. Start the script with the usual mumbo jumbo: Strict mode, importing gameClasses, and a global rockets list definition.
    Strict
    Import gameClasses
    Global rockets := New List<rocket>
    

    Just like with cities and launchers, we will have some wrapper functions. Let's start with the function to update all rockets.

  3. Create the UpdateRockets function. There we loop through the rockets list and call the Update method of each rocket we find.
    Function UpdateRockets:Int() For Local rocket := ...

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