1945 Tutorial
Creating a moving background
- Open
GameMaker
- Under
File, switch to Advanced Mode (don’t get scared from the extra stuff)
- Add
the background
- Under
Resources, click Create Background
- Load
the background water.gif. Fill in
the rest of the properties as below.
- Creating
the room
- Under
Resources, click Create Room
- Unclick
Draw background color
- Click
next to <no background> and select back_water (it will tile the
water)
- Change
Vert Speed from 0 to 2 (so the background moves)
- Run
the game and you should see moving water.
Make sure to Save.
Adding Islands
- Under
Resources, click Create Sprite
- Name
the Sprite island1
- Click
Load Sprite and find island1.gif
- Unclick
Precise collision checking (islands won’t hit anything)
- Add
Sprites for island2 and island3
- Under
Resources, Create Object
- Change
the name to island1
- Choose
the Sprite island1
- Set
Depth to 10000 (depth decides what layer it should be drawn on, i.e. what
is on top of what)
- Click
Add Event and choose Create
- Drag
the Speed Vertical icon to Actions:
- Change
the 0 to a 2 (so the island will move the same speed as the water)
- After
you click ok, it should look like:
- Click
Add Event and choose Step
- On
the far right click the control tab
- Drag
a (Test Variable)
and drop it under Actions:
- Change
variable to y, value to room_height, and operation to larger than (think
of this like an if statement. if
y > room_height)
- Click
the move tab on the far right
- Drag
a (Jump to a
position) and drop it under Actions:
- 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)
- Your
object should look like:
- Repeat
this for the other 2 islands
- Click
on Rooms and place the islands somewhere in the room.
- Run
the code to see your islands appear and disappear.
Adding a plane
- Create
a sprite
- 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)
- 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)
- Create
a plane object
- Choose
the Sprite of the plane
- Set
the Depth to –100
- Click
Add Event
- Click
Keyboard
- Choose
<Left>
- Drag
a (Test Variable)
and drop it under Actions:
- Fill
it out as below:
- Drag
a (Jump to a
position) and drop it under Actions:
- Set
x: to –4 and y: to 0
- 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.)
- Add
the event for <Up> - if y is larger than 40, jump 0,-2
relative (-2 because the background is already moving)
- Add
the event for <Right>
- if x smaller than
room_width-40, jump 4,0 relative.
- Add
the event for <Down> - if y
is smaller than room_height-40, jump 0,2 relative
- It
should look like below when you’re done:
- Place
the plane into your room
- Try
out the game and see if you can fly