Strategies in Game Design

Game Maker tutorial – Page 1
GameMaker 1945 Fighting Lightning
And our last enemy airplane you can create in a similar manner to the first enemy airplane
(obj_enemy1), except that this plane moves upwards instead of downwards. You should be able to
whip this baby out in about a minute.
a. Make a Sprite for it (spr_enemy4); be sure to ‘Center’ its Origin Point.
b. Make an Object for it by duplicating obj_enemy1 (obj_enemy4).
c. In its Create Event, set it’s vertical speed from ‘4’ (the value you copied, which
moves the plane downward), to ‘–4,’ which moves it upward..
d. In its Step Event, when should you destroy it? When it goes off the top of the screen!
Change the ‘If a variable has a value’ setting to y = ‘smaller than –32.’
e. Because this plane is such a pain in the butt, it should not be “immortal.” When it is
destroyed, let’s leave it destroyed until its alarm clock goes off again. To do that, go
to the Collision Event with obj_myplane and Delete the ‘Jump to a given position’
Action and replace it (in the same spot, third from the top) with a ‘Destroy the
instance’ of ‘Self’ Action. The display should look as you see it, below:
f. In the Collision Event with obj_bullet, again,
delete the ‘Jump to a given position’ Action and replace it (in the same spot, third from
the top)
‘Destroy the instance’ of ‘Self’ to end it’s immortality.
Also, let’s make this plane worth a lot of points: ‘Set the score’ relative to ‘40.’
The display should look as you see it, below:
Game Maker tutorial – Page 2
g. That’s the plane, now to put it in the game via the controller_enemy.
Open up the Create Event and ‘Set an alarm clock’ for ‘Alarm 3,’ to ‘3000’ steps.
That will bring in the first instance of this new enemy plane type 100 seconds into the
game. The display should look as you see it, below:
h. So, open that Object up.
Add an Alarm: Alarm3 Event. For its first Action,
‘Create an instance of an Object.’
The x coordinate is still ‘random(room_width),’ but the y coordinate is along the
bottom of the screen behind the control panel; set the y coordinate to ‘Room_height+16,’
which merely places it 16 pixels up from the bottom of the screen.
i. Finally, ‘Set an alarm clock’ and have another one of these planes fly up every ten
seconds (‘300’ Steps) after the first one. The display should look as you see it, below:
That’s it! Test is out and see what you think of the new airplane type (look out).
Coming next: Time Lines!
Game Maker tutorial – Page 3
G. Introducing Time Lines IMPORTANT
Sequence of
Which?
Defining a Time Line
Action is one way that
you can more tightly
script a game’s
Sequence of Events
(i.e., its over-arching
storyline).
Every Step Event that
you create for individual
Objects in your game
builds its Sequence of
Play. That is because
the Actions in a Step
Event are repeatedly
checked every single
‘Game Turn’ (i.e., 1/30
of a second). By
definition, the activities
that are constantly
repeated every Turn
constitute that game’s
Sequence of Play.
In the 1945 game you have developed thus fare, the appearance of enemy aircraft was
controlled by the controller_enemy Object. From time to time it added another instance of an
enemy plane to the game. Since most enemy planes where never destroyed, they just
reappeared, this resulted in a game that became increasingly more difficult because the number
of planes would steadily grow to unmanageable proportions.
While this system provided reasonable game play, it has a number of problems. First, the
planes appear at random positions that you, the game designer, cannot control. As a result,
planes might end up on top of each other or so close to the sides of the screen that they cannot
be shot at. Thus, there is very little “surprise” in the game; enemies come at you randomly and
there is little the player can do than just shoot all the time and try to avoid them.
To achieve more interesting arcade-style game play, you (now the Level Designer) need more
control over which planes appear, where, and when. You’re about to learn how to create enemy
planes that arrive in formations and to create other player challenges (e.g., a massive group of
simple enemies that should primarily be avoided, or a few dangerous enemies that had better
be shot immediately.) This has the advantage of assisting new players to your game as they
will remember useful patterns from playing it previously that will help them advance further
the next time they play; ultimately, they’ll enjoy the satisfaction of “beating” the game.
All good arcade games tend to control the enemies rather precisely for these reasons. Put
simply, it results in more interesting and enjoyable game play. That is why you’re about to
learn how to control the appearance of enemies through the Time Line Resource.
1. Save a new version of your game. Call is ‘1945 (time line).’ We’ll mod this version so as
not to mess up your previous builds of the game.
2. First, we need to make several small changes to the game. For each of the different enemy
planes, we no longer make them reappear when they shot, collide into the main plane, or
leave the screen. Instead, we simply destroy them.
See the screen shots below (these are taken from obj_enemy1 as an example) to guide you
through this process:
Before:
After:
Game Maker tutorial – Page 4
Thus, once a plane is gone, it’s gone forever. The Time Line will now controls the
creation of enemy units.
3. Here’s the skinny on Time Lines: Think of a Time Line Resource is as a Global Event. In
it, you specify particular Actions that occur after a given number of moments of time
(measured in Steps) have elapsed. In this particular game, we are creating Time Line
Actions to create the enemy planes only, but you can add any Actions you like (which
makes Time Lines an extremely powerful design tool in Game Maker, so learn this lesson
well).
Okay, let’s create the Time Line Resource.
Go to Add, ‘Add Time Line,’ and name it ‘tl_enemies.’ The display (your Time Line
“operating table”) should look like this:
Buttons used to
add, remove, and
otherwise modify
‘Moments’ in
Time Lines.
In this box
will be your
listing of
“defined
Moments.”
And in this box you will put
Action icons that define
what happens at the
selected Moment. This
works just like it does in the
Object Properties window.
Game Maker tutorial – Page 5
Now, Add a Moment at step ‘0.’ That wasn’t so hard. The Action for that
Moment is to create an enemy place at the appropriate place (we’ve already
defined the appropriate time, which is Moment 0). Select tab main1 and drag the
‘Create an instance of an Object’ (light bulb) icon over to the Actions box. In
the pop-up window, you want to create obj_enemy1 at coordinates x = ‘320’ and
y = ‘–32.’
Why Those Placement Coordinates?
Why did you place that first enemy airplane at 320, –32? Simple! The width of the game screen (the x
coordinate) is 640 pixels, so x = 320 places it in the middle of the screen. The row of pixels at the top of the
screen equals 0 pixels, so this plane needs to start at y = –32 pixels so it can ‘fly in’ from above.
Game Maker tutorial – Page 6
As it takes about 100 steps for an enemy aircraft to traverse the Room, let’s
‘Add’ a second Moment at step ‘100.’ Now ‘Create an instance of an
Object’ twice.
Make them both obj_enemy1 and put the first one at
‘200, –32,’ and the second at ‘400, –32.’ Easy, right? It should look like this:
Finding Coordinates
on the Room Map
Then ‘Add’ a third Moment at step ‘200.’ Now we’re going to create a big
diagonal line of enemies. Ready? Create six instances ‘obj_enemy1’ and place
them at: ‘200, –32,’ ‘260, –64,’ ‘320, –96,’ ‘380, –128,’ ‘440, –160,’ and ‘500,
–192.’ Do you see the pattern here in the x, y coordinates that will bring in
these planes in a diagonal line? Each one 60 pixels over to the right and 32
pixels further from the top of the previous plane. Now you’re looking at this:
Why 100 Steps?
We don’t have to time a
plane’s journey between
the top and bottom of the
screen to figure out it
takes about 100 steps. We
can simply do the math
instead.
The resolution is 640 x
480 pixels. That means
that it’s 480 pixels from top
to bottom. But we added
the information display to
the bottom, and that was
72 pixels tall, leaving a
playing area that is 408
pixels (say 400 to make
the math easier).
Enemy planes move at a
vertical speed of 4 per
step. 400 pixels to travel at
4 per step = 100 steps.
To find the coordinates
within a Room, open it up
and look in its Room
Properties window. As you
scroll the mouse cursor
around the Room, its x
and y coordinates appear
just below and to the left of
the Room display.
Note that the coordinates
are in 16 x 16 pixel
‘chunks’ that represent
each Room square in this
game. To be exact, the x
and y coordinates given in
the display represent the
4. Okay, you get the idea about building Moments in the Time Line. You can make “V”
top-left corner of that
flocks, blend in the harder aircraft, and so forth… but none of those things happens until
square.
you manually set them to in the Time Line! Remember, it takes about 100 steps for enemy
planes to make it between the top and bottom edges of the screen. We’ll get back to
expanding your Time Line in a moment.
For right now, let’s test out the Time Line out before we continue to build it up further
with brilliant challenges for the player.
To make the Time Line start working so we can check it out, it must be placed into the
Room. To do this, it must first be assigned to an Object, and then the Time Line’s Actions
will be performed for that Object. We have to ‘fix’ the Object controller_enemy anyway
to have it stop creating random enemy aircraft, so we’ll use that.
First, Delete all the Events and Actions for the Object controller_enemy. Good, we need
to get rid of all of those Alarm clocks; that’s because that’s not how we’ll be adding
enemies to this version of the game (we’re adding them via the Time Line). From a clean
Object Properties screen for controller_enemy, add a Create Event. The Action for this
Event you can find on the main2 tab: ‘Set a time line.’ Select the Time Line ‘tl_enemies’
and leave the Position in the Time Line set to ‘0.’ This means the Time Line will start at
the beginning; you can set this variable to skip the beginning and repeat certain parts.
Game Maker tutorial – Page 7
That’s it! Since Object controller_enemy is already placed in the Room, this baby is lit.
Save your game, and ‘Run’ it see your first three waves fly in.
5. After those three waves of enemy planes, nothing else happens. So, now go ahead and
create a bunch more waves of enemy airplanes like you did in #3, above. Just keep
adding Moments with more and more dangerous planes in interesting formations. You’ve
also got obj_enemy4 to play with flying up from the bottom of the screen!
The matrix below is one you can use for the enemy planes that
move from bottom to top (obj_enemy4)
‘X’ coordinate values
‘X’ coordinate values
100 150 200 250 300 350 400 450 500
100 150 200 250 300 350 400 450 500
-288
432
-256
464
-224
469
‘Y’ coordinate values
‘Y’ coordinate values
The matrix below is one you can use for the enemy planes that
move from top to bottom (obj_enemy1, 2, and 3)
-192
-160
-128
-96
528
560
592
624
-64
656
-32
688
The top edge of the Room is the bottom of this grid.
The top edge of the information display
is the bottom of this grid.
For example, in the matrices above, you can see two particularly vicious attacks. On the
left are two well protected formations that should really hurt the player’s plane. On the
right are a scattering of obj_enemy4 aircraft that will keep the player hopping.
Game Maker tutorial – Page 8
It will take a bit of work to create a complete Sequence of Events (i.e., listing of Moments)
that makes up a nice game level in Game Maker. In a full, multi-level game you would
create different Time Lines for each level (i.e., “Room”).
6. After you’ve created a total of about nine or ten waves of attacks, you need to have the
game end (and not just scrolling along forever without end, as it currently does). To do
that, add one last Moment about ‘400’ Steps after the one before it (to give everything in
that penultimate Moment a chance to happen).
At that moment, you should display a congratulatory message
(tab main2, ‘Display a message,’ and then something like ‘You
survived all the attacks!’ After that, show the High Score Table
(tab score, ‘Show the highscore table’ – you can figure out the
parameters for it), and then restart the game (tab main2,
‘Restart the game’). You should see a display that looks
something like the adjacent illustration.
Of course, if you can figure out how to create a nice ending
sequence, such as an aircraft carrier appearing on which
your plane lands, that would be even better, but you’ll have to figure that out on
your own time.
7. Time Lines Summary: As you can see, using Time Lines is some additional work; you
have to specify all of the enemy planes that appear and give them formations. When you
do, however, that makes you officially a Level Designer. (Congratulations!) Employing
Time Lines gives you, the Level Designer, a flexible tool that you can use to create more
interesting and challenging game levels.
Please consider that there are many things that you can do with Time Lines. In this
tutorial, you used them to control the global flow of the game. However, you can also use
them to control the behavior of game Objects over time. That is, at a given Moment,
you can change that Object’s Action(s).
There are also many tricks you can do with Time Lines. For example, to “loop” a time
line (i.e., have it repeat over and over), at the end add a Moment in which you set the
position of that Time Line back to ‘0.’
To halt a Time Line for a while, add a Moment in which you test some condition and, if it
is “true,” set the time line Position relative to ‘–1’ (think of the –1 position on the Time
Line as the “Pause” button). Thus, in the next step, at that same moment, the condition will
be tested again and so on until that conditions tests “false,” at which time the Time Line
will start again.
You can also have instances change Time Lines based on certain Events, etc. There are
even variables that control the speed of a Time Line
I looked at the ‘Show help on Game Maker’ button on the menu bar to look up those
details
Time Lines are a powerful resource. Hopefully, now, you’re thinking of diabolical and clever
ways to use them to create entertaining game levels!
Game Maker tutorial – Page 9
Now on to the “Big Room.”SAVE
GAME 1945_lastname_5