1945 Tutorial

Creating a moving background

  1. Open GameMaker
  2. Under File, switch to Advanced Mode (don’t get scared from the extra stuff)

 

  1. Add the background
    1. Under Resources, click Create Background
    2. Load the background water.gif.  Fill in the rest of the properties as below. 

 

  1. Creating the room
    1. Under Resources, click Create Room
    2. Unclick Draw background color
    3. Click next to <no background> and select back_water (it will tile the water)
    4. Change Vert Speed from 0 to 2 (so the background moves)

  1. Run the game and you should see moving water.  Make sure to Save.

 

Adding Islands

  1. Under Resources, click Create Sprite
    1. Name the Sprite island1
    2. Click Load Sprite and find island1.gif
    3. Unclick Precise collision checking (islands won’t hit anything)

  1. Add Sprites for island2 and island3
  2. Under Resources, Create Object
    1. Change the name to island1
    2. Choose the Sprite island1
    3. Set Depth to 10000 (depth decides what layer it should be drawn on, i.e. what is on top of what)

    1. Click Add Event and choose Create
    2. Drag the Speed Vertical icon to Actions:
    3. Change the 0 to a 2 (so the island will move the same speed as the water)

    1. After you click ok, it should look like:

    1. Click Add Event and choose Step
    2. On the far right click the control tab
    3. Drag a  (Test Variable) and drop it under Actions:
    4. Change variable to y, value to room_height, and operation to larger than (think of this like an if statement.  if y > room_height)

 

    1. Click the move tab on the far right
    2. Drag a  (Jump to a position) and drop it under Actions:
    3. Set x: to random(room_width) and y to –65 (this is the body of your if statement.  So if (y > room_height) [it goes off the screen], then the island will move to a random x and a y that is off the screen.  Since it is moving, it will eventually show up)

 

    1. Your object should look like:

 

    1. Repeat this for the other 2 islands
    2. Click on Rooms and place the islands somewhere in the room.
    3. Run the code to see your islands appear and disappear.  

 

Adding a plane

  1. Create a sprite
    1.  Use the file myplane.gif (It is an animated .gif file so it will look like the propellers are turning when you play the game)
    2. Fill out the fields as below.  (Notice the X and Y under Origin are 32 and 32.  This tells GameMaker what point to use as the origin.  This is useful for setting or testing the position of the plane as well as where bullets will come from.  The easy way to come up with the X and Y are to click center)

  1. Create a plane object
    1. Choose the Sprite of the plane
    2. Set the Depth to –100
    3. Click Add Event
    4. Click Keyboard
    5. Choose <Left>
    6. Drag a  (Test Variable) and drop it under Actions:
    7. Fill it out as below:

    1. Drag a  (Jump to a position) and drop it under Actions:
    2. Set x: to –4 and y: to 0
    3. Check the box next to Relative

(Steps f-j will only move the plane left 4 spaces only if it is not too close to the left.  This way it won’t go off the screen.)

    1. Add the event for  <Up>  - if y is larger than 40, jump 0,-2 relative (-2 because the background is already moving)
    2. Add the event for  <Right> -  if x smaller than room_width-40, jump 4,0 relative.
    3. Add the event for  <Down> - if y is smaller than room_height-40, jump 0,2 relative
    4. It should look like below when you’re done:

 

 

    1. Place the plane into your room
    2. Try out the game and see if you can fly