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, importinggameClasses
, and a globalrockets
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 therockets
list and call theUpdate
method of each rocket we find.Function UpdateRockets:Int() For Local rocket := Eachin rockets rocket.Update() Next Return True End
The same goes for drawing the rockets on the canvas.
4. Add the function
RenderRockets
. Again, it loops through all rockets and calls theRender
method.Function RenderRockets:Int...