Let's begin with the basic game structure:
1. Open an empty script and save it under the file name
RocketCommander.monkey
, in a folder of your choice.2. The first line in this new script will tell Monkey to compile your script in
STRICT
mode.Strict
3. Now, add some comments about the script.
#rem Script: RocketCommander.monkey Description: Sample script from chapter #3 of the book "Monkey Game Development Beginners guide" by PacktPub Author: Michael Hartlef #end
4. This time we won't import mojo, but another file, in which we'll import all the classes and other files. This file will be created soon, under the name
gameClasses.monkey
.Import gameClasses
5. And finally in this file, we need the
main
function. Without it, Monkey will complain when you try to build it.Function Main:Int()
6. Inside the
main
function, we will create a new instance of the main class, calledRocketCommander
, and store it inside a global variable called...