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 — modifying the gameClasses file

To modify the gameClasses file, follow the ensuing steps:

  1. Open the gameClasses.monkey file.
  2. Add an Import statement for the explosionClass.monkey file.
    Import rocketClass
    Import explosionClass
    
  3. Save the file and close it.

What just happened?

You have added the explosion class to the game, so that it can be used later on.

Modifying the rocket class

Once a rocket reaches its target position, a new explosion has to be created there. We need to add some code inside the rocket class' Update method.

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