Monkey Game Development:Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action — changing the gameClasses file again

The first thing you need to do is to add a new object to the gameClasses.monkey file.

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

What just happened?

You have just added the launcher class to the game, and it can be used now.

Modifying the RocketCommander class

As we want to create a launcher in our game, we need to modify the main class, RocketCommander. To add them, we have created the CreateLauncher function. Remember, when you want to set up objects, the perfect place is the SetupGame method. Let's modify it.