GAME MAKER STUDIO TUTORIAL GAME MAKER 7/8
PART A – THE WATER & ISLANDS 1 – Adding water background as resource //page 5 · Resources > Create Background · Name: back_water · Load file from resources 2 – Create room //page 5 · Resources > Create Room · Name: room_main 3 – Adding scrolling background to room //page 5 · Inside room, click on tab named background · Uncheck Draw Background Color · Select back_water in the middle left (little image button) · At bottom, set Vert Speed to 2 <Test game – Water should
scroll down> 4 – Add sprites for each island (x3) //page 6 · Resources > Create Sprite · Name: spr_isl1, spr_isl2, spr_isl3 · Load corresponding file 5 – Create each object for each island (x3) //page 6 · Resources > Create object · Set corresponding sprite · Set depth to 10000 (to ensure that everything else is above islands) 6 – Making islands move (x3) //page 6 · Inside each island, add a Create event. · Add Vertical Speed action (move tab). o Speed = 2 (same as background) 7 – Adding islands to room (x3) //page 8 (I changed this order) · Inside the room, add each island once at different heights. <Test game – Islands should
move with background> 8 – Making islands reappear at the top (x3) //page 7 · Inside the island, add a Step event. · Add the Test Variable action (control tab) o Variable: y o Value: room_height //If y is larger than room_height o Operation: Larger Than · Add the Jump To Position (move tab) o x: random(room_width) //random from 0 to room’s width o y: -65 //above the window <Test game – Islands should now
reappear at the top shortly after going off screen> PART B – OUR PLANE 1 – Creating the plane’s sprite //page 8 · Resources > Create Sprite · Name: spr_myPlane · Load file myPlane.gif //notice 3 sub-images = animation · Under Origin, hit Center //this center’s the plane’s (0,0) point 2 – Create the object for the plane //page 8 · Resources > Create Object · Name: obj_myPlane · Pick the corresponding sprite · Set depth to -100 //so that plane is always on top 3 – Moving left //page 9 · Inside the plane object, add a Keyboard event. o <Left> · Add a Test Variable action (control tab) //check if there is room to move to the left o Variable: x o Value: 40 //40 pixels from the left side o Operation: Larger Than · Add a Jump To Position (move tab) o X: -4 //4 to the left of current position o Y: 0 o Check Relative 4 – Moving right //page 9 · Inside the plane object, add a Keyboard event. o <Right> · Add a Test Variable action (control tab) //check if there is room to move to the right o Variable: x o Value: room_width – 40 //40 pixels from the right hand side o Operation: Smaller Than · Add a Jump To Position (move tab) o X: 4 //4 to the right of current position o Y: 0 o Check Relative 5 – Moving up //page 9 · Inside the plane object, add a Keyboard event. o <Up> · Add a Test Variable action (control tab) //check if there is room to move to the right o Variable: y o Value: 40 //40 pixels from the top o Operation: Larger Than · Add a Jump To Position (move tab) o X: 0 //2 up from the current position o Y: -2 o Check Relative 6 – Moving down //page 9 · Inside the plane object, add a Keyboard event. o <Down> · Add a Test Variable action (control tab) //check if there is room to move to the right o Variable: y o Value: room_height-120 //120 pixels from the bottom, we are leaving space at bottom for score bar o Operation: Smaller Than · Add a Jump To Position (move tab) o X: 0 //2 down from the current position o Y: 2 o Check Relative 7 – Adding plane to room //page 9 · Go into your room, and add a plane in the middle of your screen. <Test game – Your plane should
move in all directions. You plane
shouldn’t be able to leave the screen.> PART C – AMMO 1 – Adding the bullet sprite //page 9 · Resources > Create Sprite · Name: spr_bullet · Load file bullet.gif · In Origin, click on Center button. 2 – Create the object for the bullet //page 10 · Resources > Create object · Name: obj_bullet · Pick corresponding sprite · Set depth to 0. //so it appears under our plane but above other stuff 3 – Bullet motion //page 10 · Inside the bullet object, add a Create event. · Add a Speed Vertical action (move tab). o Vertical speed: -8 4 – Removing bullets that are outside screen //page 10 · Inside the bullet object, add a Step event. · Add a Test Variable action (control tab). //if bullet is 20 pixels past the screen’s edge o Variable: y o Value: -20 //20 past the screen’s edge o Operation: Less Than · Add action Destroy Instance (main1 tab). 5 – Adding basic shooting //page
10 (I
changed order a little.) ·
Inside the plane object, add a Keyboard event. o
<Space> · Add the Create Instance action (main1 tab). o Object: obj_bullet o X: x //set the bullet’s x to the plane’s x o Y: y //set the bullet’s y to the plane’s y <Test game – Your plane should
now be able to shoot. Unfortunately,
it shoots too much!> 6 – Limiting the shooting //page 10 · In the plane object, add a Create event. · Add a Set Variable action (control tab). o Variable: can_shoot //When can_shoot is 1, we can shoot, otherwise, we have to wait for a bit o Value: 1 · Inside the existing <Space> (Keyboard) event, add a Test Variable action (control tab). o Variable: can_shoot o Value: 1 o Operation: equal to · Drag this action above the Create Instance action so that it appears first. · Add a Set Variable action (control tab) o Variable: can_shoot o Value: 0 · Add a Set Alarm action (main2 tab) o Number of steps: 15 o In alarm number: Alarm 0 · Add a Start Block action (control tab). Drag it so that it is second in the list of actions. · Add a End Block action (control tab). Make sure it is last in the list of actions. Below, you can see
how the <Space> event should look like: · Still in our plane, add an Alarm event. o Alarm 0 · Add a Set Variable action (control tab) o Variable: can_shoot o Value: 1 <Test game – Shooting should be
a lot slower now.> PART D – OUR FIRST BAD GUYS 1 – Adding the sprite for Enemy 1 //page 11 · Resources > Create sprite · Name: spr_enemy1 · Load file enemy1.gif 2 – Create the object //page 11 · Resources > Create object · Name: obj_enemy1 · Pick corresponding sprite 3 – Making the enemy move //page 11 · Add a Create event. · Add a Speed Vertical action (move tab) o Vert speed: 4 4 – Making enemy reappear at top //page 11 · Add a Step event. · Add a Test Variable action (control tab) o Variable: y o Value: room_height o Operation: Greater Than · Add action Jump To Position (move tab) o X: random(room_width) o Y: -50 //y = -50 is above the screen <Add an enemy plane to your
room and Test Game – Plane should constantly reappear at the top> <Remove enemy plane from room
after testing (right click on it)> PART E - COLLISIONS · Resources > Create Sound · Name: snd_explosion1 ·
Load file snd_explosion1.wav · Resources > Create Sprite · Name: spr_explosion1 · Load file explosion1.gif ·
Under Origin, hit the Center button. · Resources > Create Object · Name: obj_explosion1 ·
Pick the corresponding sprite · Inside the object, add an Animation End event (under “Other” events) //when anim ends, destroy self · Add a Destroy Instance action. 2 – Dealing with enemy colliding with a bullet //page 11 · Inside the enemy object, add a Collision event. o obj_bullet · Add a Play Sound action (main1 tab) o Sound: snd_explosion1 o Loop: false · Add a Destroy Instance action (main1 tab) //destroy the bullet o Applies To: Other · Add a Create Instance action (main1 tab) //add explosion at same place as hit plane o Object: obj_explosion1 o X: 0 o Y: 0 o Check relative · Add a Jump To Position action (move tab) //instead of destroying the plane, we move it at the top o X: random(room_width) o Y: -100 · Add a Set Score action (score tab) o New score: 5 o Check relative <Add an enemy plane to your
room and Test Game – You can now shoot the plane. An explosion should appear. Your score should increase.> <Remove enemy plane from room
after testing (right click on it)> 3 – Creating explosion object and an explosion sound for our plane //page 12 · Resources > Create Sound · Name: snd_explosion2 ·
Load file snd_explosion2.wav · Resources > Create Sprite · Name: spr_explosion2 · Load file explosion2.gif ·
Under Origin, hit the Center button. · Resources > Create Object · Name: obj_explosion2 · Pick the corresponding sprite 4 – Ending game when explosion is done //page 12 · Inside obj_explosion2, add an Animation End event (under “Other” events) //when anim ends · Add a Destroy Instance action (main1 tab) · Add a Sleep action (main2 tab) //hold for 1 second o Milliseconds: 1000 o Redraw: true · Add a Show Highscore action (score tab) · Add a Restart Game action (main2 tab) 5 – Collision between bad guy plane and main plane · Inside the obj_myPlane object, add a Collision event o obj_enemy1 · Add a Destroy Instance action (main1 tab) //remove other plane o Applies To: Other · Add a Play Sound action (main1 tab) //play sound o Sound: snd_explosion2 o Loop: false · Add a Change Instance action (main1 tab) o Applies To: Self o Change Into: obj_explosion2 //this will actually end the game and show high scores <Add an enemy plane to your
room and Test Game – You can now die if you crash into the plane.> <Remove enemy plane from room
after testing (right click on it)> PART F – GAME CONTROL 1 – Creating a controller object //page 12 · Resources > Create Object · Name: obj_controller_enemy · Uncheck the Visible box. 2 – Spawning bad guys //page 12 · Add a Create event. · Add a Create Instance (main1 tab) //spawn 1 bad guy o Object: obj_enemy1 o X: random(room_width) o Y: -100 · Add a Set Alarm action o Number of steps: 200 //in 200, we’ll add another bad guy o
Alarm #: 1 · Add an Alarm event o Alarm 1 · Add a Create Instance (main1 tab) //spawn one more bad guy o Object: obj_enemy1 o X: random(room_width) o Y: -100 · Add a Set Alarm action o Number of steps: 500 //every 500 steps, add another bad guy o
Alarm #: 1 · Add an instance of the obj_controller_enemy to the room. <Test Game – You now have a
fully functional game.> |