1. Brienna Hick
Work Flow
Our task was to create and design a 2-D side scrolling shooter game. This work flow will walk
through the process of making my game and show the development as I create it. My Idea for this
game is to create a Fantasy style side scrolling shooter set in a Forest.
Sprite
My first task was to create my main character; I did this by designing and
creating a sprite. First I had to enter the sprite creator in the game
maker software I did this by right clicking the sprite folder and
selecting create a sprite, once in the creator I opened a new sprite
sheet. Next I set up creating my sprite I went through a few ideas
before arriving at my final design.
Next I had to set the origin of my Sprite , in the tutorial it says to set the origin to the center
however on my sprite I set it to the center of my image rather than
the center of the sheet.
After that I then had to set the Mask Properties, where you edit the
collision mask, the collision mask detects when an object has entered
it, I set my collison mask to “Precise” this
means that the collision mask fits around my
design using pixels rather than a basic
geometric shape, however this may cause
problems later as this setting can cause the game to become glitchy.
Object
Now that I was finished with my sprite I saved it and went back to the main menu of game maker. I
then went to the object folder right clicked and selected create object. Once the folder was opened I
changed the text in the name box to say “Player_1”, I then loaded my sprite I made earlier into the
sprite box. After that I made sure the correct options were selected (Visible and Solid). Next I went
over to the “events” block I then right clicked and selected add event, and then selected step from
the options given to me. Once I had selected step as my option I am then presented by another
three options “step, begin step, end step” I selected the first one “step”,
once that is in the event box I went over to the tabs on the right hand side
of the window and selected “control”. Of the options given to me in the
control tab I then went to the coding sub-title and found the icon that looks
like a sheet of paper, I then dragged that over to the “actions” box this
then opened another window.
In this window I then began to enter the
2. Brienna Hick
coding for the movement of my character. This involved linking the action I wanted the object to
complete, with the key on the keyboard that would trigger the movement.
Rooms
Once I had coded it I needed to test it but to test it I needed a level to test it on. So I next went back
to the main menu and opened the “Room” folder by right clicking and selecting “create room”. Once
the window had opened I went to the “settings” tab and changed the
name from “room0” to “level1.” I then changed the “height” and “width”
settings to “W-1024” and “H-576.” I then went to the Background tab,
seeing as this was just to test the coding the background did not need to
be a complex design so I made it a simple green background. Next I
needed to place my object into the level to do this I went to the objects
tab, selected my object from the drop down menu and simply clicked in
the level to place it. Now it was ready to test. However when I went to
test it I found that I had used the wrong type of brackets when coding the
movement, but it was simple enough to go back and correct it.
Limits
I now needed to make sure that the object could not move past the boundaries of the
background so I needed to return to my coding. Here I entered a new set of codes that
would make sure that my object stayed within the backgrounds borders. Once I had entered
the coding I once again tested my game. My object now did not go past the wall boundaries.
Scrolling Background
I next needed to make it appear as though my character was moving across a level so I created a
scrolling background to do this In the main menu I went to
the background folder and right clicked and selected create
background. I then had to resize the canvas I did this by
selected the “transform” tab at the top of the window, from
the drop down menu I then selected “resize canvas” and
opened the window. Here I changed the dimensions of the
canvas to match those of the room we had created earlier
(1024x576) but I first had to deselect the “keep aspect
ratio” box. Now that the canvas was the correct size I could
begin my design. Once my esign was completed I went back
to the “Room” folder and opened my level. Once there I went to the background tab and deselected
the “draw background colour” box. I then selected the “background 0” option and used the drop
down menu (from the button next to the box that says “no background”) to select the background I
have created. Next I entered the scrolling speed by going to the box labeled “Hor. Speed” and
3. Brienna Hick
changed the number from 0 to -6. Once I had done that I could test that the background scrolled.
Once I had tested it I found that because it loops around the edges did not match and created a
visable line. I wasn’t sure how to fix this so for now I moved
forward by creating a second background that would appear
closer than the other to give the game some depth. I once
again created a new background the same way I had the last
however this time I made the aspects slightly bigger and did
not give them a background as this would overlap the
previously made background. I then put that background into
the level , again the same way as the last, however I put it in in
the section of “background1” not “background0” and also the
scrolling speed was changed to -7 to make it slightly faster I then tested this again. The background
now scrolled across the screen and had two layers going at different speeds succesfully. I then went
back and managed to edit my background to make the line where the background looped less
visable.
Particle System Effect
I now wanted to but in an animationon the back of my sprite to make it appear as though it had an
afterburner or rocket smoke effect coming out of it’s boots. For this I used a particle effect this is
ussually used for rain or snow or fire by createing a stream of particles. First I created a sprite to use
as my particle effect. For this I made it a simple circle using the airbrush
tool. Once I had completed that I named the sprite “thrust_spr” so I knew
it was different from the player sprite and centred the origin. Next I went
back to the main menu and right clicked on the create object folder to
create a new object making a different one from my player sprite. Once in
there I renamed the object from “object1” to “Jet” now instead of adding
a sprite we have to add an event because the game will generate the
particle every step of the game, so I went to add effect and selected step
and added a regular step. I then went to the control tab and drag and
dropped the code tool into the actions box. I then began to enter the
code, first I added a hint (///jet particle system) and then two lines down I needed to create a name
for this system to use in the variables and functions. So we named it “jet 1 = part_system_create ();”
now I had that I needed to add the parts of the particle effect, so another two lines down I put
“part1 = part_type_create();” I now needed to define the part type that it is, which is the sprite tha t
we just created, so another two lines down I entered “part_type_sprite ” I now needed to tell it the
part type it is so at the end of that I added “(part1,” I also need to tell it which sprite it is using, so I
then added the name of our sprite “thrust_spr,” next I needed to tell it whether it is animated or
not, if it is animated it is “true” if not it is “false” mine was not animated so I added “false,” the next
thing it needed to know is wether or not it needs to stretch the particles animation to match its
lifespan, again this is answered with “true” or “false” if you have not animated it the answer is once
again “false,” and it then needs to know if you want it to randomly play back the animation (again
answered with true or false) if you have no animation it is once again “false);” if you don’t put all of
the arguments in then it wont work. On the next line I put the function “part_type_size ” this will
make the sprite become smaller as it shoots out of the back of our player. Again I need to specify the
4. Brienna Hick
part so I add “part1,” next I need to put in the minimal size that the particle can start at and the
maximum size. If the particle at full size is 1 then half would be 0.5, so the next thing I add is “0.5, 1,”
next thing to add is the increase in size as it shoots out we want it to decrease so we have to enter a
negative number. So I added “-0.1,” the last thing I need to add is the wiggle which makes the
particle increase and decrease in size fractionally so it appears to be wiggling, we don’t want this so I
entered “0);” Now I need to specify the particle life, this is how long the particle will last for, on the
next line down I entered “part_type_life(part1,” now all I have to add is the minimum life span and
the maximum. I set these both to the same of 300 frames so “300, 300);” this seems like a long time
but the particles will decrease in size and trail off. To create the effect of the part icle moving we next
added a gravity effect this will pull the particles to a specific point to make them move. To code this,
I entered on the next line down, “part_type_gravity(part1,” next I needed to specify the amount of
gravity, to make it look more natural we put in a random effect to do this I added
“random_range(0.5, 2),” these numbers give it a range to vary between. Next I needed to set the
direction of the gravity, in game maker the way the directions work is that right is 0 and it then goes
round clockwise so directly below is 90, left is 180 and above is 270. We want our particles to move
backward (left) so I set it to 180 degrees “180);” The last part type we need to specify is the aloha
channel, this will make the particle become invisible after time. So on the next line down I enter
“part_type_alpha(part1,” now again I wanted it do do this in a random set of time so I added
“random_range(0.1, 0.75));” on the scale for the alpha in game maker 1 is opaque and 0 is
completely invisable. That’s all of the part types we need to add but now i wanted to add the depth
of the particle effect so it creates them behind or at the feet of my player rather than in the middle
of the player. So two lines down I entered “part_system_depth” an now because we are dealing with
the particle system and not the individual part I add “(jet1, 2);” 2 represents the depth that we want
the particle to be drawn on. Next we need to actually create the
particle system so two lines down I entered “part_particles_create”
the particle we want to create is jet1 so I add “(jet1,” now we need
to give the location of where we want the particles to emit from, we
want them to originate from the player so we use the x and y from
the player object to calculate the location, an offset is applied to
make them appear from the correct place on the player.
“Player_1.x-18, Player_1.y,” no we add in the part type so that all
the variables we just coded happen “part1,” and finally we add the
number of particles that will be created each step of the game “10);”
and then it should be finished. The final step is to make sure the player creates the particle system
we just set up. So I went back to the main menu and went into the player_1 folder and clicked the
add event button and then selected the create event to add to it. Then I went to the control options
in the side tab and draged the code option into the actions box. Now opening the code I enter the
hint “///create jet object” then two lines down I add the function “instance_create(x, y, jet);” and
that’s it. now I can test it to see if it works. When I tested it all off the effects worked however the
particles were coming out of my player slightly to high so I will go back and change that.
5. Brienna Hick
Player Projectile & sound
For this game to be a shooter I nee to create the “bullets” and the controls for using them so first I
need to create a sprite for that, which will be called “lazer1_spr” then I edited my sprite. Once I had
done that I needed to modify the mask of the sprite so that it is only the tip of the projectile. So I
needed to change it from having the automitic box ticked to manual. I then edited the number in the
box labeled left that is below the manual box so that the tip of the sprite is selected. Then I went out
of that window and changed the origin to the centre of my sprite. I then
clicked ok and I now have my lazer sprite.
I now need to create an object for my sprite so I went into the create
object window and named it “Player_lazer” and entered my laser sprite. I
now added an event this would be a create event. Once I had added the
event I went to the control tab and added some coding to the actions box.
In this code I put the hint “///movement” and then two lines down added
the horizontal speed which it would travel across the screen “hspeed =
20;”. Next I needed to add a step event to make sure that the projectile is destroyed when it leaves
the room otherwise it will loop round. So add a step event and some coding to that event. In the
coding I use the hint “///destroyed when leaving room” now I need to add the code for that to
happen, so two lines down I use the statement “if x>=room_width” another line down I add “{“ to
open the statement the next line down I add “instance_destroy()” and the one more line down I add
“}” to close the statement. So now if the bullets position is greater than the rooms width it will
destroy it. Now I just needed to tick the solid box to make sure my object was solid and it was
finished.
The next step was to make sure that the projectile actually fires from the player, so I went back to
the object properties of the player and opened the step event movement and added the new hint
“///shoot” now two lines down I enter my keyboard check which this time is
“keyboard_check_pressed” this way it doesn’t continuely shoot the projectile. Now I add on to that
the key which I want to trigger the projectile for this I use “(vk_enter)” now on the next line down I
open a statement using “{“ and on the following line enter the statement “instance_create(x, y,
player_lazer);” this will tell the player what object to spawn and where to spawn it, I then close the
statement on the following line with “}” I can now test if the projectile
works.
Now that the bullets work we need to add a sound to it so in the main
menu I go to the sound file and right click and select create sound. I
know used the open file button to get my sound and select it , I first had
to find the sound I desired and save it as a wav. or mp3 file to enter it,
once I had my file selected I renamed it fireball1 as that was the style of
projectile I had. I next made sure that the box “uncompressed” was selected as it is a small sound,
however for music it would be better to use streamed as it is a bigger file. Now to make the object
play the sound when it is fired I exit that and enter the lazers object properties. I then opened the
movement coding and changed the hint to read “///movement & sound” next two lines down from
the last bit of coding we entered I put the audio functi on “audio_play_sound” I then entered the
arguments which is the name of the sound “(fireball1,” next we enter the priority which depends on
6. Brienna Hick
how many sound you have going and the timing of when the sounds play, for what we are doing in
this game it is not going to be an issue so I just put “1,” and the final argument is whether we want it
to loop or not, we don’t want the sound to loop so I put “false);” and then that’s done and we can
test it.
Animated Enemy Sprite
So now I need to create my enemy this wil l be comprised of two things the spawner and the sprite
so first im going to create the sprite. I open the create a sprite window and rename it “enemy1_spr”
now im going to make this sprite animated, this sprite will be made up of 8
frames so I do my design 11 times changing it in slightly each time. I also
changed the speed of the sprite from 30, the same speed as the room, to 20 so
it’s slightly slower.however this is only an example of the speed I will need to
change the speed of it in its object settings. Now that I had created my sprite I
center the origin and modify the collision mask so that it fits the sprite.
Enemy object spawner & movement
I now crete two objects one will be called enemy_1 and will be our enemy
sprite. And the second one will be called system and this doesn’t have a sprite.
This willl be used to code a number of things within the game, now we are going to use it to create
an alarm effect. To do this you simply add an event and choose alarm and from the drop down menu
choose alarm0. The way this works is like an alarm clock you set it to a number of steps within the
game and when it is reached I will trigger an event or action. Now we have to enter the code for the
action that it will trigger. This action will be the enemy spawn so our hint is “/// spawn enemy 1”
now two lines down we are going to create a variable that is randomized and create three instances
of the enemy sprite so that it attacks as a formation. So because I want it to generate a random
number I enter “randomize();” because this does not have any arguments. Now I add the function
that will create the variable so two lines down I enter “var y_spawn;” which is the variables name.
now that I have given the variable its name I need to set the variable so on the next line I put
“y_spawn = random_range(32, 448);” so now when the alarm goes off
it will create the variable y_spawn and will create it randomly within
the range of the level. Now I need to create the instance, so again two
lines down I enter “instance_create(1040, y_spawn, enemy1);” so this
will now use the variable we created earlier to place the object on the
y axis, the x is set to 1040 so it will spawn off screen and it will use
this on our enemy object. To make three of them spawn in a triangle
formation I copy and paste the instance command so there are three
of them and change the x position so that the top and bottom one are
64 pixels behind (1104). I now change the y position on the middle and bottom one by adding +64
and +128 to the y_spawn phrase. Next we need to reset the alarm so that it continuesly spawns
these enemies. For this I enter the hint “/// reset alarm” I next enter ( two lines down) “alarm[0]
random_range(90, 120);” this will make the alram we set up earlier randomly go of between 90 and
120 frames. We now need to initiate the alarm so to do this I add a Create event. We need to do this
otherwise there will be nothing to trigger the alarm to go off in the first place. I enter some code
which will be “alarm[0] = 30” this will tell the alarm to go off after 30 frames or 1 second and then
7. Brienna Hick
the alarm will randomly repeat itself. Now we need to place the system into the room. To do this all
we do is enter the level and load up the system into the object box and click anywhere in the room,
because it has no sprite it will appear as a blue circle with a question mark in it, but it is now in the
room and will load with it.
Now we are going to code some behaviour for the enemy object. So we open it up and add a create
event. This will be the movement of the object so I open up some code and use t he hint “///
movement” now two lines down we add “hspeed = -10” this will make the object move from the
right of the screen to the left. I also want to change the animation speed to half of what it was
before. So on the next line I enter “image_speed = 0.5” this will make the animation half of the
speed it was before which was 1. Next I need to add a step event to make sure that when the enemy
object leaves the room it is destoryed and they don’t pile up and crash the game. To do this we enter
the hint “///leave room” we then enter the code two lines down “if x<0” so if the object is less than
o on the x axis (which is at the most left point) then next line down we open the function with a “{“
and next line we enter the function”instance_destroy();” then cl ose it with a “}” on the folllowing
line. Now the object will be destroyed when it leaves the room. Now we can test it out.
Enemy Destroyed By projectile
Now were going to make it so that the enemy can be destroyed by our projectile. To do this were
going to make a separate object that is a particle explosion effect, so that when the
collision mask of the projectile comes into contact with the enemies collision mask
it changes the enemy instance into the particle explosion instance. So first we need
to create the sprite for our particle effect, this will be called explosion_spr. I
decided to make this another animated sprite to give a better effect
of explosion. Once you have your sprite you just newed to center
your origin and then go back to the main menu and create an object.
This doesn’t need a sprite you just need to add a step event and the
repeat the same code you entered for the other particle system
again. All you need to do is change anything that says jet1 to
explosion1( except the first instance in which it only states explosion) and part1 to
part2, also the thrust_spr to explosion_spr and the last line needs to be changed to
say “part_particles_create(explosion1, x, y, part2, 20);” also you need to change the arguments for
the size, life and gravity of the object. It should look like this.
8. Brienna Hick
Next we need to make an alarm to destroy the instance so that the particle effect will stop after a
certain amount of time. So I add an alarm event and enter the code “instance_destroy()” once weve
done that we need to add a create event and set the alarm. So we add the code “alarm[0] = 5;” so
that alarm will set after 5 frames.
What I also wanted to do was add a sound to the explosion so I went to create sound and named it
blast1. I then added my blast sound effect. Next I went back into my create event for the explosion
and entered the “audio_play_sound” function I then entered “(blast1, 1, false);” to tell it the sound I
wanted it to play its priority and that it would not loop.
Now were going to set up the collision with the enemy object so we open up the enemy object
properties window and add a collision event. We do this by selecting add event and then choosing
collision from that, You then select your projectile from the drop down box. Once you have that you
enter some code with the hint “/// shot by player” now , two lines down, you enter
“instance_change” this will have two arguments to it, one is what instance you want it to change to
so “(explosion1,” and the other is whether it follows the coding set to that instance, which we want
it to do so “true);” so now that’s done we can test it out.
Enemy Projectile
Now were going to make it so that the enemy shoots a lazer at you. So first
your going to make a sprite for your enemies lazer named
enemylazer_spr.And your also going to center your origin and set a collision
mask to it. You are now going to create an object for it so you create the
object name it enemy_lazer and enter the sprite. Now we add a create
event and enter the code. First we enter the hint “/// move toward player”
then the if statement “if instance_exists (Player_1) the reason for entering
this is so that when the player is destroyed the enemys wont try to shoot it
anymore as the enemies lazers will be seeking out the player. If the
enemies cannot find the object they should be shooting at the game will
crash. Now we need to code it so that the lazers actually move towards the player. So I open the
function with a “{“ and enter “move_towards_point(Player_1.x, Player_1.y, 15) ;” this will make the
lazer move towards the player at the speed of 15 frames.
You can also add a sound for the enemies lazer at this point. I had already created a sound effect
called zap1. To add this I write “audio_play_sound(zap1, 1, false);” I then close d the function with “}”
Now we need to create a collision instance so that when it hits the player it destroys the bullet so it
doesn’t pass through the player. To do this I add a collision event and select the player. I then go to
the tab at the side and select “main1” in the object box there is a little whit bin with a recycle symbol
on it. I drag that into the action box. Next I add a new event called other. From the options I add the
outside room event and then I drag the recycling bin into the option box
once again. This will make sure the lazers don’t build up outside of the
room.
9. Brienna Hick
Now we need to make the enemy object shoot. To do this I enter back into the enemy object
propeties window and create an alarm event. I then add the code with the hint “///s hoot at player”
now two lines down I enter “instance_create(x, y, enemy_lazer);” this will create the lazer from the
enemy object. I then enter “alarm[0]= 20” this will repeatidly shoot the lazers 20 frames apart. Now I
go back to the create event code and initiate the alarm by adding “alarm[0] = 20” so now we can test
that out.
Shield Variable
Now we are going to make a damdge system for the player object. First I open the system object
properties. Now I’m going to create a global variable that will act as the hit points or damadge
sysem. So I create a new piece of code within the create event with the hint “///shield” now two
lines down I create a new variable, but this time it will be a global variable so I enter “globalvar
shield;” a global variable works the same as a normal variable but it can work between different
objects, if this was created as a normal variable it would only work with the system object. I am
creating it like this because I am going to visualy represent the shield stregnth by drawing it as a bar
at the top of the screen. But I cannot do that within the player object because if I put a draw object
inside a player object , instead of drawing the player sprite it will draw the health bar, this is why I
am doing it in the system. So now I need to set what the shield is so “shield = 100;”
Now we need to draw the variable. To do this I add a draw event. In the add event menu I select
draw and from the secondary drop down menu I then selcet draw again. Within that I create some
code with the hint “///draw shield” now two lines down I enter the function “draw_rectangle_color”
now you need to add in the arguments which are The x coordinate if the left of the rectangle, The Y
coordinate of the top of the rectangle, The x coordinate of the right of the rectangle and The Y
coordinate of the bottom of the rectangle. So I add “( 32, 32,
32+global.shield, 40,” the last one is the end of the rectangle
so at 32 it is nothing but plus the global variable which is set to
100. The next set of arguments you need to add are The colour
of the top left corner, The colour of the top right corner, The
colour of the bottom right corner and The colour of the
bottom left corner. So now I add “ c_red, c_red, c_red, c_red,”
the last argument is whether it is an outline (true) or filled in
(false) we want ours filed in so I enter “false);” so now that is
set up to draw the rectangle now you can test to see if the rectangle is there.
Now we need to make it so that the bar will decrease when you get hit by a bullet. So we go into the
player object and add a collison event with the enemy lazer, to this I add a bit of code with the hint
“///hit” now two lines down I enter “global.shield -=25;” so now when the player is hit it will take 25
from the shield. Now it is ready to test.
Player destroyed
So now we need to set it up so that the player object is destroyed when the health bar is empty. We
set this up in the same way we did for the enemy object being detroyed. We first create an eplosion
sprite called explosion2_spr. Then you create it as an object named explosion2 and use a step event
with the coding as shown in the image.
10. Brienna Hick
Next we add an alarm so that it explodes for a certain number of frames and then restarts the game.
So I add an alarm event and add the code “instance_destroy()” and on the next line use the function
“room_restart()”. We also add a create event to initiate the alarm so I add the code “alarm[0] =60”
so the explosion will last 2 seconds. You can also add a sound so two lines down I enter the code
“audio_play_sound(blast2,1,false) I had created my sound
earlier.
Now we need to go back to the step event in my player object
to add the coding to test whether the shield has reached 0
and change the player object into the explosion. So I add
some new code with the hint “///destroyed”then two lines
down I add the statement “if global.shield <=0” now on the
net line I open the function with a “{“ and continue on the
next line “ instance_change(explosion2, true)” now we also need it to destroy the jet to do this I
press tab to keep them separate and then we add the function “with(Jet)” this allows us to change
an object outside of the one we are in, on the next line open the function with “{“ and another line
down use “instance_destroy()” we need to do this so that the jet does not continue to exist whilst
the player has been destroyed. Now we close both the functions by doing two lines of “}” this is now
ready to test.
When I tested my game I found that once the player was destroyed the enemy lazers froze on th e
screen. So I went to the alarm event in the enemy object and added (two lines from the top) the if
statement “if instance_exists(Player_1)” I then encompast the statement that was already there in
these “{}”. So now when the player is destroyed no lazer bullets will be created.
Score System
Now we are going to create a system that will record the score. So I enter the system object and in
the create event add a new piece of code with the hint “///score variable”. Now two lines down I
enter the global variable “globalvar points;” we cant use score because that is an object that is
already created within game maker so we use points. On the next line down I put “points = 0;” so
that you have no points at the start of the game.
11. Brienna Hick
Now I want to draw the score under the shield bar but first I need to create a font. So in the main
menu I go to the font file and right click to select create font. I know name the font font1 and then
select the font I want from the drop down menu. I also change the size of my font. One I have done
that I return to the system object and go to the draw event and add a piece of code with the hint
“///draw score” two lines down I put “draw_set_font(font1);” on the following line I enter
“draw_set_color(c_white);” so now it will use my font and the font will be white. On the next line I
set the horizontal alignment with “draw_set_halign(fa_center);” this way the text will be centered.
The final line I add is “draw_text( 36, 40, global.points);” this will set the x and y coordinates and the
last part is what it willl draw.
So now we need to set it so that it adds to the score everytime a enemy gets destroyed. So I go to
the enemy player object and enter the collision event,I then add to the pre exsisting code, two lines
down, “global.points +=1;” now the score will increase by 1 everytime a enemy is shot. Now we can
test that out.
Enemy 2 & tweeks
Now I went about creating a second enemy. First I created my enemy sprite and my enemy lazer
sprite I named these “enemy2_spr” and “enemylazer2_spr”. Once I had the sprites I created the
objects “enemy_2” and “enemy_lazer2” from them. Within the second enemy object I added a
create event ane entered a piece of code.
Once I had done that I next added an alarm event (alarm 0) for this I added
the code for shooting at the player.
Next I added another alarm event (alarm 1) and entered this code for the movement of the object.
12. Brienna Hick
Now I added the code for when the enemy leaving the screen on the x coordinate and also setting
the limits on the y coordinate.
First I added a step event and entered the piece of code for the enemy leaving the screen which
looks like this.
Next I added another piece of code to the step event ,
this time for the limits.
And finally I add a colission event with the player_lazer and enter this
piece of code.
Now in the enemy_lazer2 object I added create event with the code below.
I had made a second sound earlier and named it
Zap2 this would play when the lazer is fired.
13. Brienna Hick
Next I added in a step event and entered this piece of code.
Finally I added a colission event with my Player_1 object and In the code simply entered the
statement “Instance_destroy()”
Now I went into the system object to make sure that the enemy object spawned and to also add in a
few extra bits. First in the create event I added a new piece of code to create the second enemies
alarm. In this code I used the hint “///enemy2 spawn alarm” now two lines down I enter the code
“alarm[1] = 60”
Now I set up a new alarm event (alarm 1) and enter this code to spawn my second enemy.
Back in the create event I add some bacground
music. I do this by going to the main 1 tab and
selecting from the sound section “play sound” in
this I simply select the piece of sound , which I
have already created in the game, and tell it to
loop by selecting true.
I now wanted to create a start and end screen. To do this I first created two rooms with dark
backgrounds and placed one above level1 in the main menu and one below. The one above I
renamed “main_menu”.once I had done that I created three sprites for the buttons, this was very
simple, first I changed the canvas dimensions to have a width of
98 pixels and kept the height at its default setting. Now entering
the sprite I filled it in to my prefered colour for the button and
used the text tool to write the action the button would perform
onto it. In the editor I used the buttonize tool ,which can be
found in the images menu, to make it look more professional.
I now made all my sprites into objects and to each added there respective actions. For the “start”
button I added a mouse event “left button” and aded the action “go to next room”, this can be
found in the main1 tab under the room section. For the “exit” button I again used a mouse event
14. Brienna Hick
“left button” but I now added the action “end the game” which is in the main2 tab under the game
section. And for my “restart” button I added a mouse event “left button” and used the action “go to
previous room” which is in the same location as the “go to
next room” action.
Now I placed these objects into my rooms. I placed the start
button and exit button into the main_menu room, and the
restart button and exit button in the “end_game” room.
I now needed to add and edit some code in the explosion2 object. First I went into the alarm event
and edited the piece of code so now instead of resarting the game when the player died it went to
the next room, to do this I changed it to the code “room_goto_next()” I also went into the create
event and added a stop sound action so that when the player died the background music would
stop.
My game was now ready for it’s final testing.
Once I had completed that I selected file , create aplication. I then saved it as a single runtime
executable. My game was now completed.