When you open the starting file, you should see a “+” beside Objects – when you expand the folder, you should see these objects.

Islands

Island 1 object

Go into the object island 1. Add the Create event so when the room loads, have it moving down at the same speed as the room, Vertical Speed 2.

Add a Step event to check if the island is out of the bottom of the room, to jump to a spot before the top of the room…

  • Test Variable: if variable y is larger than the room_height (if the island is lower than the bottom of the room), then
  • Jump to Position where x = random(room_width) and y = -65 (so it won’t come in at the same horizontal position to make it seem more random; and it starts totally above the room so it “slides” in).

More Islands

Right-click on island1 and duplicate it … then change the name & sprite for island2

Right-click on island2 and duplicate it … then change the name & sprite for island3

Place Islands in Room

  1. Double-click on the Rooms folder (or click on the “+”) to expand.
  2. Then double-click on room1 to open it.

Go to the objects tab and click in an empty area to choose the island objects.

Place an island in each row, so you have 2 of each type of island object at different heights in the room, in alternating rows like this…

Save your game and test it out.

  • Does the water move?
  • Do the islands move down with the water together?
  • When an island leaves the bottom of the room, does it reappear at the top?

Main Plane

Our main concern is to avoid the plane moving outside the room. First we check if the plane is able to move (not too close to an edge) using Test Variable; if we can, then we move it a little bit using Jump to Position (needs to be relative to where the plane is currently!)

Remember the (X,Y) for GameMaker…

Here an explanation of how we get the X & Y values for the next part.

  • Our plane sprite =65 x 65 px. Distance from edge of plane = 65/2 = 33.
  • moving LEFT, we need to make sure our plane is at least 40 for x.
  • moving RIGHT, we need to make sure our plane is 640 – 40 = 600 for x.
  • moving UP, we need to make sure our plane is 480 – 40 = 440 for y.
  • moving DOWN, we need to make sure our plane is above our bottom score panel we will be adding later (which is 76px high), so 76 + 40 = 116 and adding a bit more room. So 480 – 120 = 360

Moving Horizontally

Go into the myplane object and add the <Left> Keyboard event:

  • Test Variable: check if x > 40, if yes, then
  • Jump to Position (-4,0), relative

Add the <Right> Keyboard event…

  • Test Variable: check if x < 600
  • Jump to Position: (4,0), relative

Moving Vertically

Add the <Up> Keyboard event…

  • if y > 40
  • then Jump to (0,-2), relative

Add the <Down> Keyboard event…

  • if y < 360
  • then Jump to (0,2), relative

Room

Click where the arrow shows below to place the plane at the middle of the bottom like this…

Save and test it out – check that you can move the plane but it cannot move out of the room at the top/bottom, or off the sides.

Enemy 1 Plane

Moving

Go into the enemy1 object. First add a Create event where it moving downwards with

  • Vertical Speed 4

Out at the bottom, In at the Top

Add a Step event.

  • Test Variable: if y > 512
    Checking if enemy plane gone past the bottom of the room, so
    480 (room height) + 32 (height of plane) = 512
    has the plane gone past the bottom of the room?
  • If so, Jump to Position: x = random(room_width), y = -16
    so it starts above top of the room

Add Planes to Room

  1. Change the room grid to 32×32.
  2. Then place about 4-5 of the enemy1 planes in your room and test it out.

Save and test the game.

  • do they fly down when in the room?
  • once they’ve gone out the bottom, do they reappear at the top?

Enemy 1 Controller

We’ll create a controller to keep creating enemy1 planes with a bit of delay.

Go into the object enemy 1 controller.

  • Create event
    • Create Instance: enemy1 object,
      X = random(room_width) and Y = -16
    • Alarm1 = 100

Duplicate the Create event for Alarm1 event.

Then add a Test Instance Count action at the top. If there are less than 8 of the enemy1 planes in the room, then we will create another enemy1 plane.

Replace Planes with Controller in the Room

Put the enemy 1 controller object somewhere near the bottom of the room…

Also delete the enemy1 plane objects from the room.

Test out if it works. If it does, continue.

Enemy 2 Plane

Enemy 2 object

Start by duplicating enemy1 to create enemy2 – change the name & sprite.

Enemy 2 Controller

Duplicate enemy 1 controller object. Name it enemy 2 controller.

Go into the Create event and change the following:

  • Create Instance: enemy2 object (instead of enemy1)
  • Alarm2 = 200

Change the Alarm1 event into Alarm2 event.

Change the actions for the enemy2 plane:

  1. Go into the Test Instance Count action: change to if there are less than 5 of the enemy2 planes
  2. Create Instance: change to enemy2 object.
  1. Make sure to change the Alarm1 actions to the same as in the Create event: change to Alarm2 and set to 200 so that your enemy2 planes will loop.

Your enemy 2 controller should have these actions for the Alarm2 event.

Add Controller to the Room

To check that it works, go into your room and add enemy 2 controller object.

Enemy 3 Plane

Enemy 3 object

Duplicate the enemy1 object again to create enemy3. Change the name and sprite.

Enemy 3 controller

Duplicate the enemy 2 controller – name it enemy 3 controller.

Go into the Create event, and change the following…

  • Create Instance: change to enemy3 object
  • Alarm3 = 300

So the Create event should look like this…

Change the Alarm2 event to the Alarm3 event.

Go into the Test Instance Count action – change to if there are less than 3 of the enemy3 planes in the room. Also go into the Create Instance action and change to enemy3 object.

Also change the Set Alarm2 to Set Alarm3 action – and the value to 300.

Your Alarm3 event should look like this…

Add Controller to the Room

Now add the enemy 3 controller to your room.

Test it out and make sure you see all 3 planes flying down.

Score Panel

Create event

Go into the object life controller. Add a Create event

  • Set Score: to 0
  • Set Lives: to 3
  • Set Health: to 100

Draw event

Add a Draw event with the first drawing actions…

  • Draw Sprite: sprite = bottom, x = 0, y = 404
    = 480 (room height) – 76 (height of bottom graphic)
  • Set Color: yellow

Then add these 3 actions on the Score tab…

  • Draw Score: x = 180, y = 440
    caption – delete, no caption, it’s already on the background
  • Draw Health: x1=12, y1=449, x2=138, y2=459
    back color = none, bar color = green to red
  • Draw Life Images: x=25, y=410; sprite life

So your life controller’s Draw event should look like this…

Room

Add the life controller to your room.

Test it out – does the score panel look like this when playing?