Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

3. Game #2, Rocket Commander > Time for action — implementing the rocket launch...

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 to call the corresponding method for all existing launchers.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial