Making Your First Game: GameMaker Studio 2 (Without Any Coding) | Gurpreet Singh Matharoo | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Making Your First Game: GameMaker Studio 2 (Without Any Coding)

teacher avatar Gurpreet Singh Matharoo, GameMaker Mentor and Instructor

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

31 Lessons (2h 14m)
    • 1. A1 - IDE

    • 2. A2 - Events

    • 3. B1 - Actions

    • 4. B2 - Variables

    • 5. C1 - Player Ship

    • 6. C2 - Room Boundary

    • 7. C3 - Scrolling Background

    • 8. C4 - Manager Alarms

    • 9. C5 - Bullets

    • 10. D1 - Conditions

    • 11. D2 - Enemy Ships

    • 12. D3 - Shooting the Enemies

    • 13. D4 - AI Shooting

    • 14. E1 - Player Cooldown

    • 15. E2 - Loops

    • 16. E3 - Player Health

    • 17. E4 - Losing

    • 18. F1 - Score

    • 19. F2 - Scripts

    • 20. F3 - Indicators

    • 21. F4 - Health Powerups

    • 22. F5 - Speed Powerup

    • 23. F6 - Main Menu

    • 24. F7 - Game Over Screen

    • 25. G1 - INI Saving

    • 26. G2 - High Score System

    • 27. G3 - MusicSFX

    • 28. G4 - Building an Executable

    • 29. H1 - Difficulty Scaling

    • 30. H2 - Enemy Horizontal Movement

    • 31. H3 - Player Ships

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Hey there! This class is all about game development for complete beginners. You'll learn to make your own games without any coding!

We'll be using GameMaker Studio 2 to make our game, using its unique Drag & Drop feature, which lets you program games without having to learn coding. You can use GameMaker's free trial version to start the class!

Note: I'll be actively adding lectures to this class until it is completely finished.

The class is divided into separate, lettered sections (A, B, C...).

We begin the class with a simple introduction to GameMaker and its interface.
Then we learn about how objects work in GameMaker and how to program them using actions, which are part of GameMaker's Drag & Drop system.

After the quick introduction, we start making an arcade shooter game. By the end of the class, we will have made a fully-functional arcade shooter that is genuinely fun to play.

So what are you waiting for? Join in and become a game developer today!

Meet Your Teacher

Teacher Profile Image

Gurpreet Singh Matharoo

GameMaker Mentor and Instructor


I'm Gurpreet Singh Matharoo, a GameMaker Mentor and Instructor. I love making games, but even more than that, I love teaching others how to do so. I have done so through my tutorial website (GameDev Palace), Udemy courses and my Discord server (GM Helpers).

I've also been featured on the YoYo Games Blog as a guest writer.

Check out my classes if you're interested in learning GameMaker!

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. A1 - IDE: Hey there and welcome to the course in the section I'll be introducing you to the interface off gamemaker and how it works. So this lecture is about the interface and resources, so let's jump into it. You'll see this green when you open gamemaker studio, too. You can click here to create a new project here to open a project that you created, or here to import a project that someone sent to. When you click on new, you have to choose between drag and drop and gamemaker language. Dragon Drop doesn't require and according but gamemaker language does so for discourse. We're gonna go over drag and drop. Now here it's asking me to create a folder for the Project Soil into the project name here , Introduction and Hit Save and Noah Project is created. Game maker is centered around. Resource is so the sidebar has a list ofall the resources in your project, and in this workspace you can add it your E sources so you create your sources here. Enter netted them here. You can also see that the resources lives already has a lot off orders. That's because there are many different kinds. Office also as you can create, So the three main types of your sources are sprites, objects and rooms. Sprites are basically images for your games, so it can be a place pride. Aucoin's Pride s pride for the players, health and so on. Objects allow you to program those brides so you can create a player, object from the players pride, and then make a move and jump. Then you can also make a coin object, and then you can make the player object. Collect the coin object so things like these are programmed inside objects. Rooms are simply the Wrangler rooms where you can put your objects and then play the game so you can build your levels inside a room by placing objects. When you place an object inside a room, it becomes an instance, so you can have one object, and you can place multiple in stone sales in the room from that one object. No, you can right click on the folder or for resource type to create a new one. Soil rightly call strides. Click on creates pride and annual sprite will be created. It'll open up in the workspace. You can change the name off the sprite. Here I begin my sprite names with the longest s and then the name off this pride. Then you can click on added aim is to open gamemakers image editor, where you can draw this pride before drawing. You can click here to change the size off the Sprite, or you can import an image file by clicking here. Now let's move on to the next lecture. We will talk about objects. 2. A2 - Events: Hey there, Indus Lecture. You learn about objects and events. In the previous lecture, I told you that objects could be programmed to do certain things. So now let me tell you how that is done. Let's say we have an object. You can add actions inside that object to make it do certain things. For example, you can add an action to make the object move to the right. So using an action, you're telling her object to move. But along with the action itself, the object also needs to know when the action should be run. For example, you may want to run only once, so that it moves to the right only once. Oh, you may wanted to keep running so that it keeps moving. Or you may want it to run only when the right arrow key expressed for that. It runs Bears owned a player in port. So this is very events come in using events, you can basically control the timing off the actions, so actions always put inside events and the events control when the actions run. So now let's switch over to gamemaker. I'll go to the resource bar and create a new object. I start my object names with a lower case all and then comes the name. Now this is the object ater. You can assign us pride to the object from here. Now this is the events vigil so you can add your events here. So I click on adamant and they are the creative end Now this is the actual window. So you add your actions here Now back in the events window, we added the creative ends disseminate runs only ones And that's when I start starts working in the game. So all the actions inside it will run only once as well. Then we have the CEP event dis events. August keeps running as long as the instances in the room. So it runs every frame off each second games and game maker on that 60 prince was again. So we need second. There are 60 steps. The game goes through sort of step events basically around 60 times in one second. So any actuals you put inside it will keep running as well. And now we have the drive ends. Dis event is the same as a step event. But in this event you can use a drawing actions to draw something like a Sprite. Awesome text. Now let's move on to the next lecture. Every learned about using actions. 3. B1 - Actions: Hey, Dio, welcome to the section in this section will be going through the fury off Dragon Drop programming before we start making our game. So in this lecture will see how actions can be used to move instances. Et Esther's has two values for exposition in the room and expel you and a Y Value X is the horizontal position. And why is the vertical position distance where the instance is in the room? So by changing the X and Y values, you can make the instance. Move in any direction in game maker. If you increase the eggs, it moves to the right. But if you decrease X, it moves to the left. Similarly, if you increase the why it moves own. But if you decrease the why it moves up so by simply adding and subtracting values from X and Y, you can make an instance move. So no, no, it's opened up gamemaker. I've imported a new Sprite here for our object, so I'll go to objects and opened object that we created in the previous lecture. I'll assign the ship's pride to it. No, we need to make the shape move with the arrow keys So, first of all, our click on add event, go to Key Down and slack left the key don't event runs as long as the key is held, Joan. So if you present left key dis event will run on, it will keep running until you release a key. So now we'll add an action. In this event. You can see all the actions here, and you can search for one here. So here all sorts jump. I need this jump two point action, so I'll drag it into the event. No, this action is used to set the X and Y position off the Istres so their diet starts move to that position. But by using the relative check boxes here, we can increase or decrease the X Y values so the DIA stars could move, as has had earlier. You need to decrease the X value to move left. So I'll take the relative books for X and here type minus y. So whenever the left key is pressed, five will be subjected from ads. You can see an overview off the action here. So now we'll test it by opening the room blessing on instance off. Do you object here and running the game, you can see that I'm able to move left using the left. Hiroki No, I closed the room and go back to the object. Now right click on the event Select Duplicate event. And here's like the key downright event. This is events for the right arrow key. I'll go to the action and change the relative X value from minus 5 to 5. So this way, when you press the right arrow key, the X value will increase by five and the restaurants will move to the right. No, I let a new event and select the key down down event. This is event for the down arrow key. I'll go ahead and add that jumped two point action in this event. I'll set white relative and type five here so impressing the down key five will be added to why, and the instruments will move down now will duplicate that down event and select Bucky down up event Dissident is for the up arrow G. So to make it move up, I'll change the five to minus five. Now all four arrow key events have been set up, so all in the game. Now you can see that I'm able to move in older actions. No. As you can see, I'm using the value five in the actions. So whenever you press a key, it moves five pixels in that direction every step so you can increase or decrease this value to make it move faster or slower. Of course, then you have to change the value in all events. So in the next lecture will see how woman speed can be changed without having to modify all events. 4. B2 - Variables: Hey there. In this lecture, we learned about variables while programming anything numbers are used a lot like in our previous lecture views the number five to move our ship. So use five in all the events. So if you wanted to change the speed off the ship to say it, then you would have to change all the events one by one to done you number. But there is a way to make it so that you only have to modify that value ones. For that we can use variables. A variable is simply a name that holds a value. Let's say you want to create a variable to stroll your movement speed so you can create a variable cold more speed and said its value to five. So this is your own very well, and you've given it a name and a value. Now this very bill can be used anywhere, and it will just mean five. So the advantage of using a variable is that you continuous valley ones on it will change everywhere, so that's open of gamemaker and go to the ship Object I'll open the creative urge will be creating are variable in this event sensor terms only once in the beginning, Indy actions on such variable we need this assigned variable action soil. Drag it into the event. No dissection is used for changing the value off. A variable, swifter variable doesn't exist. It will be created. So for the variables name I'll enter. Move, underscore speed and for the value all enter five. So know this valuable is created with a value of five, so you can start using it soil. Open the four keyboard arrow events and change minus five to minus move speed and five to move speed. No, technically, nothing has changed since the speed values are still five. But if I open the creative and change the value off, most be to turn and run the game, you can see that it moves really slowly. But if I changed it to 12 and tender on the game, it moves really fast. So basically, with a variable, I'm able to control a single value in multiple events. Known us learn more about how variables work. I'll create a new object and name it or dust. I'll place it in the room. No, I'll open the object. Another creative end I learned a sign variable action and create a variable called A with a value of zero No one at the drive it in. The actions also stroll on their destro value action dissection basically draws a value in the room so you can also draw the value off a variable. Now, the caption here is that X that shows before the value. So here are our place caption with a and here you can type the value that you want to draw . I'll type a here so the value off the variable it will be drawn. No, these are the X Y coordinates where the value will be drawn. So I leave it at zero by zero. No one run the game. You can see that the value off is being drawn. Which zero? Now I'll go back to the objects and add a step event. I learned a sign. Variable action here. As you know, this action is used to create a variable, but it can also be used to change the value often existing variable. So for the variable name all type A. Since I want to change its value, Altgeld evokes because I want to add to a and for the value out I've won. So whenever the separate entrance one will be added to a you can see that in the overview here it says Add one to a and that's what we want Nowhere on the game and you can see that the value off a keeps going up each step, the value goes up by one. And since there are 60 steps in one second every second, the value goes up by 60. Now we'll go back to the object and open the creative and click on the plus sign here to create another variable. I'll name it be answered. The value to five now will open the step event and here change one Toby. So it stripped. The value off B, which is five, will be added to a. You can see that in the overview here. Now we'll run the game and you can see that is increasing at a faster rate. So start of going up by one Easter. It's going up by five, which is a value off B. So, no, you should have a basic idea off how variables work. They'll build a load when we start making our game. No, let's move on to the next lecture 5. C1 - Player Ship: Hey, there in the structure will make our player ship. I'll start by creating a new project as, like Dragon Draw and call the projects. Be a shooter. No first trip. Our need to import us pride. So I create a sprite resource and call it as player. I click on imports to import a player image. And now let me tell you about Sprite audience. The origin is basically the point in a sprite where the Objects X and Y coordinates are and a spider dates from that point. Right now it's set to top left, but we need to make it middle center. This way. The X and Y coordinates will be at the Sprite Center, and if iterated it rotate from the center, Boyd No will create an object for it and call it or player. I'm assigned this pride. No one had a creative it. In this event. Turned aside variable action, I'll create a variable called Move Speed X and started to eight. So this is a movement speed for the X axes only, which controls the left and right movement. Now, a click on the plus sign here to create another variable and name it's move speed by I said it to five. This is the movement speed for the Y X is only which controls up and down movement. So as you can see in this game, we're gonna have different speeds for the horizontal and vertical movement. W should be able to move left and right faster than they can move up and down. No money to set up the arrow key events. So for Tyler, Ducky Down Left event in the actions, all sorts jump and there the tempter for inaction to move left, you subtract from X soils that extra relative and type minus move speed eggs. No, another key. Don't write event. I'll add the tempter for inaction, said Extra relative and type move Speed X. So now the player ship can move left and right. No wonder the key don't up event. I'll add the action, said White Relative, and I minus move speed. Why? So doesn't move it up. I'll are ducky down down event allowed the actions that white relative and type move speed . Why? So now the ship can move up and down as well. Now I'll open the room. You can change the size off the room here. If you want, I'm gonna keep it at the default size. So please a player object in the room an hour on the game. You can see that I'm able to move around under the move faster, horizontally and slow vertically. Now let's move on to the next lecture. We will implement a room boundary. 6. C2 - Room Boundary: Hey there, in this lecture, we're going to implement a simple room boundary. Basically, we don't want a player to be able to go outside the room, so I'll start by opening or player. I click on adamant. Go to other, another interested boundary event, DISIP entrance. Whenever the oysters touches the boundary off the room inside, it allowed the jump to born action, I said the X to experience and why two y previ ous experience is a bit invaluable that strolls the instances expedition from the previous step and why previous straws of I from the previous step. So basically, these very able store the last position off the Istres before you moved it in the grand step. If you start typing experience, you can see that it shows up in the layers as a built in variable. Then you can click on it to select it. Silver, never the player that is the boundary off the room. It'll move back toward spring exploration so it won't be able to go out off the room. No one under game and you can see that I'm unable to go outside the room. No nurse, move onto the next lecture, reveal a roast rolling background 7. C3 - Scrolling Background: Hey there. In this lecture we learn a strolling background to the game. I've imported a background image here. It's a simple voter texture, So I opened the room and go to the layers panel. I select a background layer under the properties. I can select an image for the background source like Bywaters Pride. Now you can see that it appears in the room, but only ones. So I'll go to the properties and enable horizontal and vertical Tieling. Now it feels the rule. Now we'll go to properties and stroll around. I'll said the vertical speed to four so the background will keep going tone at four pixels per step. So this way it will give the illusion that the player shape is going forward when it's actually the background strolling down, sold on the game and you can see that a background is moving. No nurse, Implement the islands. I'll start by creating a noose. Pride and a lame It s island. I've lived on import. No, I need to import these four island images into once pride. So it's like these four files and click open. So now we have four frames in our stride. Generally multiple frames are used for animations, so you have a play button here on an animation speed, and if you hit the play button, that's pride enemies. But we don't need these four frames for animation. We just want anyone of these images to randomly show up for the island, Soil said. The animations p to zero so that the spry doesn't animate. Anna said the origin to Middle Center. No, let me explain to you the imagine decks off us. Pride. Imagine Dex is a built in variable in objects that stores the number off the frame that is being displayed, so the first frame is zero. The second frame is one and so on. So when we create island object, we wanted to select a random frame in the 0 to 3 range swell. Create an object caldo island. I designed this bright No. One there to create event in the actions. Also, it's random. I need this catcher in the number action soil dragged in dissection. We give me a random number in their age. So Ford that rage and said the minimum 20 and the maximum to three. I'll change decimal to interior. Since we don't want decimal values and in the target all type. Imagine decks. So this action will return a random number in the 0 to 3 change and then apply it to imagined X. So the analyst us will get a random frame from the bride now in the actions also its speed and add the set speed action dissection sets the speed all day, Mr, so that it starts moving a chain direction to vertical since I wont dying stars to move vertically instead of moving in a specific direction. I said the speech before, so it'll move down at a speed of four. The speech would match the vertical speed in your rooms. Background. No, I click on add event. Go to other and at the outside room event deceive entrance when dying stars goes completely out of the room. So in that case, we want to destroy die in Stan's. If we don't destroy it, then the island ist answers will keep adding up and increase the memory usage so well. So let's destroy and they're the destroyer starts action here, so basically the stars will be deleted when it goes outside, the room now will open the room and go to the layers panel. I click here to create a new instance layer. So basically, this is not a layer for placing instances. I'll hit after you and rename it toe islands. Now make sure that explains below the instances layer but above the background layer. Now we'll play some island instances in this layer so the island instances will appear belodeau player ship because the island's layer is blowing chances layer. Now we'll run the game and you can see that the islands have different images and that they move down. But we also need to make it so that more island stances are created automatically, so we'll do that in the next lecture. 8. C4 - Manager Alarms: Hey there in this lecture will set apart manager and alarms. So far, we have two objects in our game. A shape and an island. No, you're going to add a manager object simply gold or manger manager. Objects are used too many things that the game used to do in the background. So it's not an actual entity or a thing in the game, for example, will be using our manager object to create New island instances in the room. So while the manager object doesn't actually show up in the room, it manages the creation off the IRA nation says, And in little lectures we can use the same manager object for more things. But for no, we just needed to create island instances using alarms. As you know, we need the island. Instances to keep coming in for our game will choose to create one island everyone second. So we're gonna do that using alarms, alarms or events that can be set to run after a short in time. So, for example, in the creative and you can set alarm 0 to 60 steps. So then the alarm zero event will run after 60 steps, which is one second than in detriment and Island will be created. Dan Alarm zero will be set to 60 in data event so that it runs again after one second. So this way it'll keep running everyone second. So that's got do it. I'll create a new object and name it or manager in the object allowed the create event in the actions. Also, Salam and Ardo set alarm Kondo name, and here you can type Rich Alarm event you want to set. There are 12 alarm events, as you can see in this list, so I'll keep the even number at zero. And for the countdown. All said 60. For now, the alarm's revenge should run one second after the creative entrance. No. One at the alarms event here, we're going to create an island. Instance. If this is our room, then we want to create the island instance above it so that it comes own so while the starting by position will always be the same, the starting exposition will always need to be random. So in the actions also stand, Um, and there the guts random number action dissection will give us the island's exposition. I'll 10 decimal two in teacher because coordinates should workers being teachers to award issues. Now I'll keep the minimum at zero and said the maximum toe 1024 which is the vert off my rule in the target all type Island X. So it'll create a valuable called Island X that was stolen, random value returned by the action, and now we'll take temp. So this to make it a temporary variable instead of a normal one. Temporary variables are deleted when the event ends. We know that we're not gonna need this valuable outside of this event, so it's better to make a temporary now. All sorts create another create instance. Action dissection peers are new instance in the room. So for the object, I slash o island. These are the coordinates where the newest US will be created, Soil said. The extra island eggs, which is a random value, returned from the section I said divi to minus 100 so it'll be created above the rule. Now. You may have to adjust the Y value if you're using a different islands pride. So if you don't see the islands at all, try increasing the Y value because it may be getting pleaded for being outside the room now for the layer all type islands, so this layer must exist in the rule and I leave the target empty. This basically stalls are created. Instances I d to a variable, but we don't need that now. Allow the alarm action. I'll settle, um 0 to 60. So that's where the alarms your event will keep running it second. And creating Island in San says now will open the room and select dying stances layer. I'll place a manager object in the room and general in the game, and you can see that more ordination sales are being created by the manager. Now let's move on to the next lecture. Be able implement shooting. 9. C5 - Bullets: Hey there in this lecture of will implement shooting. For that, we create a bullet object. That object will always keep moving up. And when it goes out of the room, it would be destroyed. So we'll make it. So when the player presents a space key, a bullet instances created Adam players position. Just wear the player will be able to shoot. So let's get to it. I've imported us pride for the bullet here. No, make sure that its origin is set to middle center. Now we'll go to objects and create a new one or limit or bullet. I'll assign the bullets pride to it. Knowing this object allowed the creative end in this event and at the same speed action, I'll change direction to Vertical since I wanted to move up and to move up the why needs to be reduced, Soil said the spey to minus 20. No, it'll go up at a high speed. No, we need the outside room event in discernment allowed the destroyers transaction. Now I'll open the room and go to the layers panel. I'll create a newest us layer and name it bullet. Now this is a layer where the bullets will be created. It'll be below their trances layer so that the bullets appear below the player share. Now I'll open no player. Click on add event and go to the keepers events. As you know, the key documents run as long as the key is being held. But the key presidents run when you first heard the key only ones. So you have to release the key and then hit it again to run the event again. Swells like the space key. No in dissident about the creating stance action for the object, a select or bullet for the X Y position. All enter X and Y X and Y are built in variables that store the position. Often instance, Since this action is running in the player object, the bullet will be created at the players position. Now here I'll enter the leader's name, which is bullet and again only target empty. Now run the game. I can shoot by hitting spares. No, we have a small challenge for you. The challenge is to create two bullet and stand sales. Went a player shoots instead of one. Here's a hint. You can add a subjective value to the exploration off a new instance to place it to the left or the right. Now let's move on to the next lecture. They will start working on the enemies. 10. D1 - Conditions: here in this lecture, we learned about conditions. You know how actions work you at an event, and then you add an action inside it. So when the event is activated, the action Roland's desperately simple and despair. Conditions can be used. Basically, conditions are used to control when the action runs, so only when the condition is true will the action run. Otherwise the action will not run. Conditions are something we all use in our daily lives. Let me give you an example. Let's say you have to spend some money. You don't know how much money you have, but you're about to Jack. So in your mind you make the structure. If the amount of money you have is greater than 100 spend 50 else spent 20. So if you have more than 100 bucks, you want to spend 50. But if you don't, then you just want to spend 20. So you're basically putting a condition or Nouriel Life actions so similarly, you can put conditions on gamemaker actions as well, so that's learn more about conditions in game maker. I'll create a new Dragon drop project for demonstrating how conditions work. I simply name it Conditions now here are create an object. I'll quickly place it in the room. India. Absurd allowed the creative end. Here are their does. I'm variable action. I'll create a variable called a and 32 0 No, I led the drive and he will be joined some text and controlling it with the condition sold such if here and heard this if variable action. This is a conditional action. Using the section, I can test whether a variable is equal to a value less than it greater than it and so on. So for the variable all type A for the condition onset equal and for the value all said zoo , So this will check whether it's value is equal to zero. You can also see that in the overview here, it says if is equal to zero and there's a condition no well search for the draw value action. I'll drop it on the side of this action to attach it to the condition. So now this action will only earn if this condition is true. Now in the caption, all right is zero and leave the value empty, so it'll simply draw that X is zero when is equal to zero soldier on the game and you can see that the text is being drawn because is you? Now we'll go to the creative and and change is value to one. And if I run the game, no, you can see that that extra isn't drawl. That happens because this condition becomes falls since is nautical 20 anymore. So the connected action does not run. You can also see that we have a Nordic books here. This basically flips the condition around. So if I take it, you can see in the overview. It says, if is nautical to zero. So now the condition has changed. Dissection will know run if is, nor deal swell. Chain that extra reflect that. And now on run the game. You can see that that extra is being drawn since is one which is nor deal first. I learned check the North checkbooks now will open the creative end, and change is value to 200. Dana led the step event. Here are alert design, variable action. The variable will be a and for the value all time minus one. Alter gravity. So e step the value off a will go down by one. Now I'll open the driver and a gender condition from equal to greater and for the value all type 20 know the condition is that the value off a needs to be greater than 20 a soldier in the caption to reflect that. Now you know that a starts at 200 so that's definitely greater than 20. But he step. It goes down by one, so at one point it will go below 20 soil. Run the game and you can see that is greater than 20. And now it's not. No. We'll go back to the drive and in the actions, all such else. I lowered the else action below the if variable action. So you know how if the condition becomes false, the action doesn't run anymore. When that happens, the action connected to else will run soil. Add a new draw value action and a 32 l's Junior's caption to A is not greater than 20. Swift is greater than 20 dis caption will be drawn, but if it's not greater than 20 then description will be drawn so either one of these actions will run depending on this condition, No. One in the game and you can see that a is greater than 20. And now it's not. So the conditions are working as they should. You can also start the value in these actions toe a so that you could see what's going on behind the scenes so you can see the value off a here and there goes below 20. So now you know what conditions are if you have any questions or if anything was hard to understand, feel free to post a question. And now I have a challenge for you. Make it so that when you president up arrow the value off it goes up by one. And if you press the down arrow, the value off it goes down by one and using conditions make it so that if is equal to zero a draws Hey, and if is equal to one, it draws. How are you? And if a is equal to two draws goodbye now, let's start with the next lecture. We will make our enemy ships 11. D2 - Enemy Ships: Hey there in Destructor relied enemy ships to our game here. I've imported us bright for the enemy. Make sure it's ordinance set to middle center. Now we'll create a new object and name it or enemy. So this will be the enemy ship. I'll assigned this bride. No. A lot of creative earned in dissident alert A set speed action ultra in direction toward a girl and said the speed to two So the enemy ships will move downwards at a speed of two. No wonder, no step event. No, we need to make it so that the enemy of stars is destroyed when it goes out of the room. So, as you know, we can use the outside room event for that. But we want to create our enemies above the room so that they come down from there. But that's outside the room as well. So the instances will just get deleted. So we want to make sure that the enemies are only destroyed when they're below the room. So for that will use a condition, reject the instances why value and make sure that its creator than the room hide then will destroy dying stars. So in the step event allowed the if variable action, the variable will be why all said the condition to greater and the value to room hide. So as you can see in the overview here, it checks if the Y is greater than the room hide now whether the destroying starts action and adapted to this condition. So the instance will be destroyed when the Y is greater than the room wide. No money to implement any Miss morning soil open or manager and open the create event. A click on the plus sign here to add another lamb. Condon Alarm zero is used for the islands, so for the enemies, I lose alarm one, and the count on value will be 60 and no alert the alarm on demand. Indus Event allowed the cat random number. Action will use this action to get a random exposition for the enemy shape, just like we did for the islands. So I'll change decimal two in Teacher. I leave the minimum at zero and said the maximum to 1024 which is my room word. And for the variable all type ship X, I'll make a temporary. No wonder the creating transaction for the object and slash or enemy. The exposition will be shaped x, which is a random value returned from the previous action. The VIE position will be mine in 64. So to be created above the room and the layer will be instances which is a default layer. No, we need to set the lumber on countdown again so that alarm keeps looping. But instead of setting the alarm to a specific value, I'm gonna use it and, um, action so that their son variation in the enemy's bonds so alert another. Get random number action. Here I'll change a similar to in teacher because lahm values are generally indeed now well said the minimum to 60 which is one second, and the maximum 2 to 40 which is four seconds. The variable name will be a long time. I'll make a temporary No wonder the alarm. Condon Action. The event will be alarm bon, and the countdown will be a long time. So the alarm countdown will be based on the random number from this action. Now we're under game and you can see the enemies dancers warning from the door. But there is one issue. When the enemy ships reached the bottom, you can see them being destroyed. So let's see why that happens. I'll goto our enemy step event. As you can see, we destroy dying stars. If the Y is greater than the room wide, the way of doing stones is at the center because the origin off the sprite is said to middle center. So when that center point, which is the Y, becomes greater than the room, hide the instances destroyed. So half of the ship is still visible inside the room when it is destroyed. So to fix this, we can increase the value in the condition story. Instead, a room height. We can check out room height plus 64. So that will be 64 pixels below the room boundary. That point is outside the room. So when dying stars is destroyed there, it won't be visible in the room sold. Run the game. I skip a bit ahead and you can see that there no destroyed when they're still in the room. And now we need to add another feature as you know the range for the exposition, often enemy from zero to the room where so the enemies can spawn anywhere from the left border to the very tight border. So we need to add Martine's on both sides so that enemies told spawn in those areas. This law also make the game easier for the pairs, since enemies will be spawning in a smaller area, soil open or managers alarm One event. We need to set a margin value, so I'll go with 1 20 pixels as the margin Soil said. The minimum 2120 annals object 1 20 from the maximum value. So now the margins are implemented. Now the enemy is the North's bone in the margin area. So that's it for the lecture. Let me know if you have any questions, and now let's move on to the next lecture. We will implement enemy shooting. 12. D3 - Shooting the Enemies: Hey there. In this lecture of will implement shooting the enemies, the enemy object will have a variable called HP Which is there help for our enemies. DSP will be to each time a bullet hits and any me. It's health caused on by one. And when the health reaches zero, the enemy instances destroyed and an explosion is created. Ad its place. So let's get to it. I'll start by creating a new Sprite called S Explosion. Click on import. This is the explosion animation that I want to import. You can see that it holds on to strip image with all the frames inside it. It has six frames and I won't gamemaker to split all the frames into separates of images. So for that, I voted underscore strip six At the end of the file, name six of the number off frames and seeing that game maker will automatically spread the frames into separate images. So if your strip has eight frames, you need to write it here. If it has to al frames, you need to write well and so on. Soil import this image. It's no split into separate sub images, and the animation can be played. Also, make sure that you start the origin to middle center now will create an object, a name, it or explosion. I designed this pride and know a lot of creative event. He led the got random number action. I need to said the rotation off the subjects tour and in value so that when an explosion is created, it almost looks different. Soil chain decimal two in teacher keep the minimum at zero said the maximum to 3 60 entered the target to image Underscore angle. These values are in degrees, so that's why the next poem is 3 60 degrees and the target image. Anger is a built in variable that controls operation off the instance, so the major angle will get a random value from 0 to 3 60 degrees. Now we'll click on Add a variant, go to other and select animation end December entrance when the Sprite animation ends. If the explosion animation errands, we don't want it to keep looping soil at the destroyers transaction in this event, so the explosion animation players worms and done it's destroyed. No, we'll open or enemy and go to its creative and here are alert us. I'm very but action and initialize a variable at B. I think it's value to to. Now I'll open a stepparent on search for the if variable action. I'll drag it in, but make sure that the drop it here not here so that it's outside the condition. The very well being checked will be HB. The condition will be less or equal and the value of zero. So this condition Jax What did that P is less or equal to zero, which means that the enemy should be destroyed. So with that condition, Malatesta destroy instance Action Denel search for the creating stance action and added under the same condition for creating the explosion. So for the object I'll select over explosion, the position will be the X and Y off the enemy extends itself and earlier will be in stances. So when the enemies that spirit zero it will be destroyed and an explosion in stars will be created at its place, now will open or bullet. I click on add event. Go under collision and select or any me December entrance vendor Clarendon Star status, and it starts off the other object here. The current instruments is all bullet, and the other object is or enemy, so disciplined will run whenever a bullet touches an enemy here, we need to reduce that Enemies at B soil adamant Sign valuable action here. First of all, a click on the Cerro. Through this menu, you can select which instruments the action applies to. For example, if I create a viable using this action, it will be created inside or bullet. Since this action is running inside the oval, it object. But if it's like oh, player here, then the variable will be created inside. Oh, player and auto bullet because that's where the action will be applied to the opening stance. So itchy India's two other so that the action runs inside the other instance in the collision event. The other instance here is the enemy stars colliding with a bullet so this action would run in that enemy. Instance, the variable being changed here is HB, and the value is minus wonder to do so when a bullet here's an enemy that enemies HP will be reduced by one. You can see that dissection has a purple border, since it is being applied to somebody in stars and no double. It'll start itself. Dunder should also destroyed up without instance. Now we're on the game, I assured the enemies, and you can see that they're destroyed after being Hitwise says they HP is, too. You could change the SP 21 so that they're killed in one head or you could change it to a larger value to make the game more difficult. That's it for this lecture. Now let's move on to the next one. We will implement AI shooting. 13. D4 - AI Shooting: Hey there, in this lecture, we're going to implement a I shooting for the enemy ships. We've only enemy ships to keep shooting as they come down. So for that we'll be using alarms so that they keep shooting. But we also need to make it so that they only shoot when the player is in front of them. Otherwise, they should not shoot. So to achieve that, we have to use some mad. This is the X coordinate off the player and this is the Y. Coordinate. For this, we only need the X. And here's the enemy's X coordinate. You can see that as a player gets closer to being in front of the enemy. The difference between the enemies X and the players, extra juices. This is when the enemy should be able to shoot. So to make the enemy shoot, we just had to check whether the difference between the enemies X and the Players X is below a certain value. If it is, then the enemy should shoot. So here's what we'll do. We'll get the difference between the players X and the enemies. X Phillips tried that as a player X minus X writing this in gamemaker will get deplore instances X coordinate, so this will get the difference. But it may be pulled straight or negative, depending on where the player is, the only want a poster value. So around the subtraction, I'll add brackets. And outside those records, all type A B s doing that will make it so that only a poster value can be returned. So if the difference is negative, se minus 28 it'll give us a poster value like 28. So this way we get the distance between the players, eggs and the enemies X. Then we can use that value to check if the enemy can shoot. So let's open up, gamemaker. I've imported us pride for the enemy's bullet. Make sure its origin is how to middle center. No for the enemy's bullet. I'll goto a bullet right click, cornered and slack duplicate. It will create a new object with the same parents will name this 10 bullet enemy. I'll assign. Despite to it, no, I will open its create event. You can see that the speed here is minus 20 because the players bullets are supposed to move up. But the enemy's bullets need to go down, so I'll just remove the minus sign from here. Now this bullet will go downwards. Here you have a Christian event with the enemy, but since this is the enemy's bullet, it needs to hit the player. So right click on the event. Slight change of and then go in the collision and slash or player. And now this is a collision event with the player. So when this bullet hits, the player deeply is that people go down now will open no player. I'll go to his creator meant I'll create a new variable with the assigned variable action. It'll be SP with a value of five. So this is a players held and we'll come back to the subject in the next lecture. Now will open no enemy and go to its creative, and here are already set alarm Condo in action. I'll touch from 0 to 60. That alarm will be used for the shooting, so allowed the event for that alarm. First of all, I ladder if variable action in place for the variable type this so this cancer distance between the players X and the enemies X Now we need to make sure that does. The stress is low enough so that the enemy could shoot, so chain the condition to lives and in the value all enter 1 28 so the distance should be smaller than 1 28 Now I let a creative transaction and adapted to this condition for the object has left a bullet enemy. The position will be the enemy's X convoy, and the layer will be bullet. So if W. Is in front of the enemy, it cleared sub alert Instance. Now Why Don't know dis condition is true. We've owned the alarm to keep looping, so it's like to get random number action and drop it below the condition so that it's placed outside of it. I use this action to set a random value for the alarm, so I'll change a symbol to interior aside the minimum to turkey and the maximum to 60 now in the target. Normally, I would use a temporary variable and then you that variable in an alarm action. But you can actually start the alarm directly from here without using the alarm action, so you have to type along with 10 square brackets and then the alarm number inside them. So this will get a random value between 30 and 60 and directly assign it to the alarm. No word on the game you can see there. The enemy shoot went up there is in front of them a device they don't. Now let's move on to the next lecture. We will work on the player being hit. 14. E1 - Player Cooldown: Hey there, in this lecture, we're going to implement a player cool down, basically, if an enemy's bullet here stop player. We've owned a player to become transparent for one second. Wild. A player is transparent. The enemies can't attack it. And then after one second, a player should return back to normal. This will be done using a cool on variable. At the beginning, it will be at zero. When a bullet hits a player, it will check with the Doppler schooled on variable is at zero if it is then deeply, as HP is reduced and the coolant very Willis had to 60. That will also make the player transparent. So whenever a bullet hits a player, it will see that the cool down is not a zero, and so it will not end a player. Now he stepped. The coolant value goes down by one surrender, cool on value reaches zero. The bullets will be able to hurt a player again. So now let's get do it first. Opal Opal, no player and go to his create event. Click on the plus button here and named this new variable cool down. Its value will be at zero no alert the step event, first of all allowed and if variable condition here disconnection with Jack. But the golden very well is greater than zero, and that means that the player has been hit so alerting. Assigned variable action and adapted to this condition. The variable will be cool down and the value will be minus one relative. Swifter colon value is greater than zero if you go down by one now. Well, such alfa here and address sentenced us all for action under the same condition. This has the alpha or a pesty. All die in stones, so at one it's fully visible at zero is completely invisible on a 0.5. It's transparent. You can also use any value between zero and one for the Alfa. So well, said the all 4 to 0.5 to make a transparent and now a search in earnest. Look, any actions attached to this bloke only run if the previous condition is false, which means that the cool down is not greater than zero. So in that case, I want to reset the instances transparency. So I'll add the olfaction here, attach it to Earls and started to one. Now I'll open Noble it enemy. I'll open the open air collision event. I'll add the variable action here and adapt elections. Do it now. Here we want to check, but it a player school on value is at zero so forceful. I click on this arrow and apply this action to other because the other objects here is a player so the valuable will be cooled down and the commission will be equal to zero. So if the players cooled on value is at zero, only then will it such go down. Now we'll click on the plus button. Here I'll set cool down to 60. Since this action has already applied to the other instance, it was had a player schooled on variable to succeed. So now the player can be heard for one second, and now we're in the game Now. You can see the players once I can go alone in action. Now let's move on to the next lecture. We learned about looks 15. E2 - Loops: Hey there in this lecture, we're going to learn about loops for this. I'm going to go back to the conditions project that we created in the conditions lecture. I'll open the object that we have here and legal the events inside it. First, I'm going to show you a simple example, using if variable conditions, soil at the creative and here and here at assigned variable action, I'll initialize a variable called a zero. Now let's step event here alert the if variable condition, I said the condition to check. If is less than 200 I'll add in the sign valuable action ended attitude to this condition. I'll make its order that want to weigh its value so you can see in the overview. It says that if is doesn't 200 it should have one, too. A source gonna keep adding one to A until it reaches 200 because at that point is no longer smaller than 200 because it's equal to it now. While at the draw event, I learned the true value action here using this action al droids value. Now I run it on. You can see that it keeps going up until her do just 200. So that's pretty simple. And you know how it works. When the event comes to this action, it's extra condition. If it is true, it turns this action, adding one to a after that it moves on. Since there aren't any actions after this, it moves on to the draw event dear. It draws the value off a the next frame in the step prevent attacks, a collision again as one to it and moves on. Then again, it draws a value off a so each frame. This process repeats and you can see is value going down and now will open the step event dollars to place life condition with my loop. First of all, our detectives, action from the condition and lead the condition itself now will search for a while here and at the lie loop. Action here now will attract is action to the UAE loop. You can see that the via loop action is very similar to the if variable action, so I'll make a check whether a is less than 200 just like the condition before. The only thing that has changed is the flow of execution When day event comes to this action, it checks the condition and runs this action, adding one to a. But then it doesn't move on because it's a loop. It goes back to the condition and takes it again. So if the condition is true, transaction again that it goes back to the condition again and checks again. So this will keep on happening forever in the same frame until this condition becomes false and the loo breaks. And you know that the condition will become false when area just 200. So that's when the loop will break. Only after that it moves on to the driver and and Rosie's value. So you're not gonna see its value go up to 200 because the value is increased to 200 only in one frame using of I loop. So I'll donate and all you see here is 200 because it happened in only one frame. No, that's learn about four loops. I'll open the drive, and I thought for here and at the four loop action here, I looked at the draw Value action Do it. A four loop is basically the same as a while. Loop The only difference is that in a four loop you have a variable to control How many times a trance that variable here is. I know it can be called anything. So here that variable is initialized at a value of zero. Then they have a condition here detects if I is less than 10 and here it is I a plus equals one, which means that it would add one toe I. But that doesn't immediately happen. It only happens at the end of each loop. So here's how the floor goes when I went, comes to the faction it. Any slices have a bullet in here, which is? I then rejects the condition. If it is true, it turns the actions that asked to this loop. After that, it comes back to the section and there's one. Do I? Then it takes the condition a game, and if it's true, it runs the action. Then again, it comes back as one toe. I text the condition and runs the action. So since I is increased by one each loop at one point, it will re Stan and this condition will become false. So that's when the loop will break and the event will move on. So this way we know that this action will run 10 times and in each loop the variable I has a different value. And the look stops when I read Justin because that makes the condition falls. Now you know that East Loop gets a different I value. So if you use the I value in the position off the text, it's gonna be different for each loop. So first fall I'm going to change the value from a toe. I then in the vie position a type II multiplied by 20 do sort of. I position where this value will be drawn with the I multiplied by 22. Now we're in the game. You can see all the values off. I hear the look stops when I reach a stand so that value is no drawn. Now I'll go to the condition and Jane, the value from 10 to 20 now will run the game and you can see that values up to 19 are drawn. So that's what a four loop is, and we've using it to draw players held in the next lecture 16. E3 - Player Health: here in this lecture will display the players held Withdraw. The health has heart using a for loop. The loop condition will make sure that the blueprints sp times swifter players sp three. You'll see three hearts. Let's go do it here I've imported US Bride 40 heart The origin for this needs to be dope left because it's not an in game object. I'll also create a few groups here and organize this brides. So now we have separate folders for the background elements, the in game elements and that you are elements now for implementing the health. I'll open a player object Click on add event Go to draw another Georgie Y event. Now, let me explain the difference between a regular joy event and a Georgie. Why event when you use the droid went to draw Something is drawn in the room on the instances layer. But when you draw something in that Georgie wife and is drawn on a separate do earlier that you earlier shows up on top off the game. So for do elements like health and score, you want to make sure that they draw on top of your game. So for that you can use a Georgie Y event now a search for a four loop in the actions and added in the event, first of all, arctic temp to make the ivory able ah, local variable for this event. Dental gender condition to Jack if I smaller than its be so sure, HP is five. The loophole and five times from 0 to 4. No in the actions on such draws, bright and slide. The draws Pride action I'll attracted to the four Loop dissection is used to draw us pride swells like the heart's pride in the do I folder now for the X and my position on right 10 and 10. So the first heart will be drawn at 10 by 10 40. Other hearts allowed There's to the X coordinate. So for each I, the X will be increased by 90. This way, the hearts will be placed horizontally. No one run the game. You can see the hearts here and as I got short to go down until they disappear, But the player doesn't die yet, so that's what we're going to work on in the next lecture 17. E4 - Losing: Hey there, in this lecture, we're gonna implement losing. First of all, I'll open or Manger. I want to add an alarm moment in this object so I'll go to add event and add the alarm to event. Also do you start here and I don't? You start game action. The action as the name stays restarts the game so we'll use the Salam View and to restart the game one second after Doppler dies. No oil open. No player. I'll go to a step event here. Aladdin If condition make sure you added below the AL section and or inside it here a jack if the SP is less than or equal to zero. So this means that the player should die? No, I need to add in alarm action. I let out to tow the condition. First of all, I'll click on the arrow here and apply this action toe Avenger. This were concerned an alarm in or manager swell set alarm to which is the alarm that we just added sad little 60 frames which would be one second no all sorts create and at the creating transaction for the object as like oh, explosion for the position. All type X and Y and a layer will be in stances, so this will create an explosion. It starts at W s position now a lot of destroying stance action here to destroy the players instance. So that should destroyed a player's instance and create an explosion in its place. And after one second it would restart, the game swelled on it, and notably I die. You can see that the player does explode, but it throws another, the other sales that it can't find any stars for a player, and the other is thrown bio enemy, and the event that has the error is the alarm. Zero event. So since we did destroy Rop, a instance theater makes sense. The enemy stances can't find a player instrument to check if they can shoot. So it throws an error, salutes aboard the game and fixed about. So I'll open no enemy and go to its alarm zero event. And now we make it so that if there's no player instance, the event should be stopped. As you can see, this is what Rose the error now here on such exists, it's like the if instance of this action I'll drop it at the top of the event, so they're simply Jackson instance exist in the room. So for that, as like to a player, So this checks if opener exists in the room. But I want to check if a player does not exist in the room. So for that I'll take the North checkbooks. So, as you can see in the overview, it saxophone player does not exist in the room. So in that case, we want to exit diva and so that the rest of the actions do not run. So in the actions are such exit us like the exit action and adapted to the first condition Swift. A player does not exist. It will exit the event, so this will preventing extraction from trying an error when the player does not exist. Now we run the game and again let a player die and you can see that it no works flawlessly . Every time the player dies, the room restarts after one second. So that's it for this lecture on Let's move onto the next one 18. F1 - Score: Hey, there in the section we're gonna work on some games and shells. So this lecture is about player points release. Ladies points in the top right corner off the game, so Brenda player kills an enemy. 100 points will be added, but 50 points will be deducted if an enemy goes by. So let's get to it. First of all, I'll go to phones right click and create a new one. A limit FND score. This phone could be used to draw the player points on the screen, so I had to the phone properties. I choose a phone from this list and said the size to 30 so the phone is ready Now I'll go to objects and open or manager. I'll open its creative end here also at school and there does that score action. This will reset the score 20 when the game starts or restarts, and now we need to draw the score. So for that allowed the Giorgio event. Also, it's phoned here and there. The set for induction using the sectional, said the phone to FND score. So now this one will be used whenever we draw any text. Now, well, such line met, I'll add a set. Exploiting production dissection lets you change the alignment off the text that you want to draw. So let's say you want to draw some text at this point by default that Texas will only aligned to the left and vertically aligned to the top. So this is how it will draw. But if you said the horizontal alignment to write, it will be drawn like this instead. And if you said the vertical alignment to boredom, it will be drawn like this, and you also have central line meant options. Since we need to draw score in the top right corner off the window, we need the right TOPE alignment, watching in the actual in value to write No one said Score. I love the drawing stance, core action. This will simply draw the score to the screen with a caption. Ill said. The caption two pts. The exploration will be room with minus tan and the Y will be 10. I'm using the room where it took out the right most edge off the JULIER. Since our room is the same size as a Jew earlier. Now, the last thing we need to do is we said the alignment so allowed the action here. Now the alignments will be set to their default values. So whenever you change anything, beat alignment, color all for you Should you said them to their default values. After you're done, using them now will open no bullet. I'll open it. Collision event with all enemy. This is where the bullet hits an enemy. So here we can jerk if the bullet has killed the other enemy in which clears will increase the points by 100. So to check that another if variable action here four star, click on the arrow and apply this action into the audience stance. I said the variable to watch be sort of Jack. If the other stances H p is equal to zero. So this Jax, if the other enemy has died well, take the set score action and it at you to this condition. I applied this action to all manager Since a score isn't that object, I said the value 200 antique relative So one an enemy dies. 100 points will be added to the score. Now will open or enemy to implement a score deduction. I'd open the step event. Now this experience checks of the enemy is below the bottom of the room, in which case it destroys. I stance. So here, if you also want to reduce the score by 50 so I'll take the SAT score action and adapted here again, I'll apply it to a manager. Then I'll said the value to minus 50 integral dough. So when an enemy goes by without dying, the score will go down by 50 floats around the game and asked that if I kill an enemy, I got 100 points. If I let an enemy pass by, I lose 50 points. So Dad said, For this lecture and or let's move onto the next one, we will work on score indicators. 19. F2 - Scripts: Hey there for implementing score indicators. We need to use something called scripts. So in this lecture will be learning what skips are and how they work. A script is like a custom event where you can put your actions and then you can run that script to execute all the actions inside it. This is best demonstrated with an actual example soil open game maker with a new project. I have two objects here with their own strides. I've placed them in the room. They're just empty objects with elections or events. Now I want to make it so that when I click on an instance, it gets bigger. So for that I can use a set instance collection, and I'm going to do that for both of these objects, So that's an easy problem to solve. I can add that action in both of these objects in the appropriate event. But what if I want to change what happens when you click on these objects? Then I have to go in and change both of these objects one by one. And it's not a big deal if I have only two objects to modify. But what if I have 10 different objects that have to run basically the same actions. In that case, it will be too serious to modify all off them one by one. So we need a way to control all of the similar actions in one place, and this is fair. Scripts come in. As I said previously, you can create a script, put actions inside it and run that script. And if you're you want, then you can have multiple objects running Gaussian actions so you can easily make any changes to those actions without having to modify all of those objects one by one. So we'll go to scripts and create one namer jane size. So this is our script right here. It looks the same as a regular event. You can add your actions from here. So also its gain and adults at a distance. Kate Action. Using this action, you can see in the horizontal and vertical scale off Diane stance. I want to increase the scale when the script is run, so I'll take relative for both horizontal and vertical. Now, here, we need to write a value that could be added to the scale. So, for example, I can read 0.1 here, so the scale will go up by 2.1, but a sort of a value. Alright, Argument zero. In both of these fields, an argument is a value that is specified. When you run a script argument, zero is the first argument. So whatever value is specified in the first argument will be you'd here. So now we can run the script with an argument in any object, so I'll open the first object here. Let the most left president descent runs when you click on the instance, so in the actions also got scraped and add the insecure skip action. Using this action, you can draw no scraped and special for you, an argument value. So for the scrape as large in size and in the argument, I'll die video 0.1. So this value will be used in the script to increase the scale of Dagestan's Now will open the second object and at the same event in action here and now we'll run the game. I can click on the instances and just gave goes up. So the script is working now because of this argument. The scale of this object goes up by 3.1. So what, you and your 20.4 I run the game again. I click on the instances. Now you can see that the second object gets bigger faster than the first object. This happens because this whole dress scale goes up by the 2.4, while the first object scale goes up by the your 0.1. This is why scripts are so useful. You can run the same actions in multiple places but make them work differently. Bears on the argument values. And now you can also expand the scraped by adding more actions. So let's make the stances fate of a nuclear condom in the actions all such awful. I let the set in stone for action. This is the opacity or transparency off the instance ultra crowded since I want to modify its value on in the value all type argument one. So this is the second argument. Now I'll open the first object in the script action, a click on the plus sign. This allows you to specify another argument for the script. Which anarchist will be added to the Alfa so we would use the Alpha and enter minus 0.1. No, I'll open the second object and do the same. And now we're in the game. No. When I click on an instance, it's off. Also go zone. So that's how scripts basically work. They can be used in many ways, and they just make life easier. So now let's move on to the next lecture. We will work on score indicators. 20. F3 - Indicators: here in this lecture of implements core indicators. This way we'll be able to see how many points we have gained or lost. I create an object called or indicator that list later added or removed points. If points were added, it show up as green text. But if points were removed, it'll show up as red text. And that object will keep moving up and keep fading until it disappears that objects and stances will be created using a script called Create Indicator. So that's got do it. First of all, I'll open the phone FND score. I attended size to 40 excess studies a bit too small. Now we'll create a new formed a name it FND indicator. I'll select a phone from this lives and said the size to 20. Now we'll have to the objects and create a new one. Ah, limit or indicator. I'll add the creative meant here now here. Already assigned variable action to initialize a variable for the tribals name all type text and in the value all type of empty string. A stranger. Some text that you write in courts so you can type anything in here and it gets stored as a text ring. So for now, we're gonna sign an empty strain to this variable. No, when you does that speed action. I joined the type to what? A girl inside the speed to minus three. So this would make dying stars move up. Now we are the step event. Also job for a nerd, a satirist council for action. We've only in starts to fade away, so I'll take relative and in the Alpha all type minus 0.1 So the alpha will go down by this value every step. It's a really small value, so it will take some time to fade away. Now let's make it sorted from the Eastern switches are really Lowell for value. It gets destroyed. So allowed the fiber connection here for the variable, all type of model for that's the variable destroys the alpha off. The instance now for the condition are check if it's less than 0.1 now allowed the destroying instance Action and attach it to this condition. So one day Majora far becomes smaller than 0.1. The instance got destroyed. Now let's draw the indicator. So for that allowed the drive and first of all, also Jafar, I learned the sad role for action. Using this action, you can said the alpha that will be used when you draw something which in our case, is the text so well said it to image are far now Where does that production also added to FND indicator Now, whether the for your collection for the variable all type text. So now the number inside the string will be checked in this condition. So a jacket for its value is greater than zero. If this is true, it means that the number is supposed to and that points for added now all such color and select US hydro color action. I'll attach it to this condition. This action will allow me to set a color for the text. So I click on the white books here and a color window will open up. I'll select a green color and hit OK. I'll also disabled use are far Now we need to add an s block for the condition so I'll drop it. But although if very of election and then a light, another said Joeckel direction ill adapted to the else now will open the color picker. And for this, select a red color. Now make sure you disabled use alpha. Now if the number in that X is greater than zero, which means that response to the carnival be said to green a device. If it's negative, the color will be said to read now when you to wear the draw value action I landed after the else the Value drone by this action will be drawn. Using the phones are fine color that we said before this, so I'll remove the caption and in the value all Internet X ray. But well said the drawing position to X and y so this really added or removed points will be drawn. And now we need to reset the color and offer values soil our directions again. So now the color and the Alfa will be set to their default values. Now we'll go to scripts. I'll create one and name it. Create indicator. Now, here all thought instruments and they're the clearance transaction for the object are slept or indicator. The position will be the X and y position off whatever instances running the script now in the target all type I nd and market as a temporary variable. So now the new instance can be accessed through this variable. So we contain the value off a variable inside that instance. So to do that, we need to add a sign, viable action now to set a variable inside dying stars that we just created. I'll type the name off that instance, then I'll put a door, and then I'll type the name off the variable that I want to set. So I want to change the value off the X ray table in the O indicator in stars that we just created. The value off that variable will be the first argument off the script. So now a script as witnessed, and we need to run it into places. First, I'll open Noble. Let I look on the collision event for the enemy. Now. This is where 100 points are added to the score soil. Add the execute script action after that, click here as like the create indicator script in the argument type, of course, for a string and inside, those goals are type plus 100 so this will be that accidental appear on the indicator, and since it's postive, it Libya Green now will go to any me. I'll open it step event. This is where 50 points are removed from the score sold. Run the scripts here as well. Now in the arguments the string with SE minus 50 now it on the game now will kill an enemy . And you can see the indicator for the points that were added. If I let in any me bus by, you can see that minus 50 indicator. So that's it for this lecture and let's continue to the next part. 21. F4 - Health Powerups: here in this lecture of will implement a health power up. It'll be a simple has power up that will spawn every 8 to 20 seconds. It'll give WR another heart. So far, this will make use off gamemakers. Parenting system Parenting basically works this way. Let's say you have object in with the events, create step and troll. Then you create object. Be now, you won't object Be to run the same actions as object. A. So you basically want to copy these events and to object? Be so instead of reading the same events and the same actions into object, be views parenting so we can make object a the parent off object Be so now object be becomes a child off object A Now all the events in the parent will run in the child as well . So if you add a new event an object a it will be added in object. Be as well. So then you can create another object say object C and Saturday as a child off object A. So now object has another child the transit, same events. So we're gonna use the system for our power ups. We create a parent object called O Power Parent that has actions that need to run in or power ups. Then we create our first power up, Oh Power held as a child of that object so it would run the same actions while being a different object. Then we can create more power ups as Children off our parent without having to add any new actions inside those objects. So let's get to it. First of all, we need to make a quick change will change the games absolution from 1024 by 7 68 to 12 80 by 7 20 The 1st 1 has a 43 aspect ratio, and the 2nd 1 hasn't 16 9 aspect ratio, which is the standard now. So to make the change, I'll open the room. I'll go to the rooms, properties and change rooms. I go to a lady bus, have a 20. This is what the room looks like now. So funny to reposition D player and Alan s stances, and I will close the room. Now. We also need to make some changes in old manager so I'll open it. I'll open the alarm. Zero event here, you can see that we're using the Value 1024 which was the weight off the room. So instead of Dad, I'll just use the room with variable. Now will open the alarm one event and to the same here. So now the new room, which will be used in these events and now the start implementing our power up here have imported us. Bride 40 has power up. I put it inside a group called Power Ups. I have also such a sword into middle center. Now we need to create a parent object, 40 power ups. So we'll create an object and name it Oh power parent this object for not appear in the game anywhere, so he doesn't need us bride. So let's add the creative end. We need this, that speed action Now we want the power of to move down just like the enemy's soil said that type two would occur and the speed to two And now there's had to step event and just like the enemies, we want a power ups to be destroyed when they go below the room. So for that we need an if condition. The variable I'm checking is why the condition is greater and the value is room. Height plus 64 then allowed the destroy instance action and attach it to this condition. Swiffer Power of goes more than 64 pixels below the room. It will be destroyed. It's the same condition that runs in the enemy object. Now we'll go to objects and create an object called O Power Health. I designed this bride now likely comparisons to open the parent menu. I can click here to assign a parent to this object. So I was like, Oh, Power Baron. So now the subject is a child off our parent. In the events, you can see that a create and a step event have appeared. These events are from the parent, so all the actions inside them would run here as well. And the events are great out because they belong to the parent so you can open them and see them. But you can't fortify them here. Nobody to set up the alarms to spawn the power ups. So for that I'll open or manager alarm von used event response, the enemies. We're going to use the same actions to spawn the power ups as well so all right, click on the lam Wan and duplicated and for the new event as liked allowed. Three. So we'll be using allowed three to spawned a power ups, dis actions, Let's or random X value. So I let it stay as it is now. Here are change the objects from, or enemy toe oh, power help So the health power will be created now just random actions like the time value for repeating the alarm. If you want a power up to be created every 8 to 20 seconds, and each second has 60 steps, when the minimum I'll enter 60 into eight and in the Maximum Island to 60 into 20 Solo on three will run again after anytime between 8 to 20 seconds. So you also need to said, there's two alarm tree now. You can also go here and change this variables name from Ship Extra Power X. Nobody just had this alarm in the create event, so I click on the plus button here to add another alarm. I'll set Alarm Tree to run 10 seconds after the game starts, so the count on value will be 16 to 10. Nobody to set up the powers behavior with the Blair. So I'll open no player. I click on Add event and under Collision us. Let's hope our health So this event will run when the player collides with the health power up. In that case, we gonna players HP to go up by one. So for that we need the sign Variable action for the variable type HB for the value all type one and Ulta Granado. So the spread a player will get another heart and then we also want to destroy the other power up in stars. So I lowered the destroying transaction. I click on the arrow here and apply this action to the other instance and now we'll run the game. First of all, it looks a lot better now with the new resolution and for the power. We need to wait a few more seconds, and here it is. If I don't, you'd I get into the heart. Now let's move on to the next lecture. We're really at a speed power up 22. F5 - Speed Powerup: Hey there in this lecture will implement our speed power up. For that, I'll create a variable Inda player called SPD short for speed. Dis variable will be used to control the player's movement speed. So if I said it 21 there should be no difference. If I said it to to, the players should move twice as fast so you can even set it to 0.5 to make the player move slowly. But in this lecture will be setting into two when the player collects a speed power up. So let's start here. Have imported us pride for the speed power up and set its origin to middle center. Now we'll go to objects. I create a new one and name. It's Obama speed. I'll assigned this pride now will open the parents menu and sent its parents to hope our parent. So now this object is such ill off power parent as well. Now we'll go to all manager. I'll open the laundry here You can see that it creates or power health only. But since we have multiple power off now, we wanted to randomly select a power up and created so for that we need that Jules action. I'll add it above the creating transaction dissection chooses one random item from multiple options. So for the first option, all right. Oh, Power held dinar. Click on the plus button here to add middle option here. I'll type o power speed, then for the target for able all type or BG, and make a temporary. So now let me explain what dissection does. We have entered two options here. One is the health power up object, and the other is the speed power up object. So this action will selector and I'm option from these true and assign it to dis viable. And then we can use that variable in the create instance action to create any starts off that object. So when you add a new power, don't forget to add it as an option here. Now we'll go to a player to make the power up work. I'll open the creative end. I click on the plus sign here to add a variable. I call it SPD and set it to one. So as you know, this variable will be used to control the players move and speed. So to implement that I'll open the first key. Don't event here are multiply the SPD value with the move speed value. So this way, if SPD said to to the playable moved twice as far. So no need to do this in all the other key don't events. So now the SPD valuable were control movement in all directions. Now, after reaching the SPD value really to reset it using an alarm so allowed the alarm. Zero event here. We need to add the assigned valuable action. Using this action, I'll said the SPD variable to one and now will implement a player's collision with the speed power up so allowed a collision event with that object. In this event, we want to increase the player speed. So allowed the assigned variable action. I'll set SPD to to then we don't SPD too, he said. After eight seconds, so honor the alarm action. I'll set alarm 0 to 16 to it so the power ups effect will be disabled eight seconds after you get it. And now we also warned the other power up instruments to be destroyed. So I lowered the destroyer stands action. I click on the arrow here and apply it to the Adonia stance. So now the bubble up in stars will be destroyed. I run the game now I'll wait for the speed. Power to appear. And there it is, Soil Decade. And now the player moves faster. Nobody to add a trail behind the Blair for the it'll create a new object, a name it openly a trail. I'll assigned a players play to it and now allowed to create event here are allowed. US officials call for action. It's starting off our will be 0.2 and now allowed to step event. I've owned this and starts to fade away. So I let us attain starts out for action here as well. I type minus 0.0 to integrate audio. So now the Alpha will go down by this value each step. Now, when the AL for it zero, we want the instance to be destroyed. So for that allowed an if condition, I'll enter image all for here. Now for the comparison, I check every it's less than or equal to zero. In that case, I want to destroy this instance. So I allowed that action and a tattoo to this condition. Now in open no player where we create that rail. I close all these events. Now we'll add an event, so I'll go on the step and select and step. And this is just another step event which runs after the regular step event. So the reason I'm using this is because there are already too many actions in the step event, So I wanted to divide them up. So first of all, allowed an if condition. Here, I check if SPD is greater than one, so this would mean that the speed power up is active. So in this case, we're going to create a trail. So I learned the creating satisfaction to the condition for the object as like Topia Trail , the position will be their players X and y, and for the lira or rentable leads, that layer is below the instances layer. So the trail will be drawn below the player, and now we start the game. I wait for the speed power up and take it, and now you can see the trail behind a player. Now let's continue to the next lecture. We will work on the Games main menu 23. F6 - Main Menu: Hey, there in this lecture will be making our games mean menu. So let's talk about the behaviour off the menu buttons. First of all, this line indicates the exposition off the bottom. So now let me explain how the Britons will work when you hover your mouse over a button. It should move smoothly to the right, and you should go back when you move your most of a so bill Judas by creating a valuable call target X that Raber was told the target exposition for the button. So the button with Moodley moved towards that target. So by default that Target X would be equal to X art. Extra is the starting exposition, often instance, so when the mouse enters the button, target X will be said toe X Start Love 24 so the button will smoothly move there. Now in the most leaves target extra, BT said to extra. So the button. We go back to its original position, and we'll also have to program the buttons to move towards the target position as it's not automatic. So let's got do it here. Having borders brides for the three many bottles. So the 1st 1 is the play, but in the 2nd 1 is the help. But in And that heard one is a quit button, so all of their audience should be set to top left. No wonder backgrounds. I've also imported a background image for the menu now, right click in the workspace and close all the open windows. And now I'll go to rules. I right, click on the room and rename it to RM game, and now we'll create a new room. I'll name it are a menu, so this will be the main menu room, so I'll drag it and put it above RM game. This way, it'll open first when the game starts. Now I'll go to the properties. Are you in the room size to duel 80 by 7 20? Now we'll click on the background layer. Here are the sign of background image. Now I'll close it, and now I go to objects. First, I'll create a new group called Menu In. This group will create an object and name its orbit and parent. So this will be the parent object for all the menu buttons. So we come back to the subject later. For now, we'll create a new object and name it over and play. This is the play button, so I'll assigned us right to it. Now allowed an event so I'll go in their mouth and select left breast. This event will run when you click your mouse on the button. So here are 30. Go to another go to room action. This action changes the room, so I click here and slept. I am game now. When you click on the play button, the um game room will open and the game will start. Now I let another object in the menu Group A Limit orbit and help. I'll assigned this bride. I won't add a mouse event here because the help button does nothing for now. Now I'll add another button object. I'll name it over an exit, I said this pride. No. Here allow the most left breast event. He have a need to add the Ezzard game action so this button will simply exit the game. And now we go back to O button Parent, I'll open the furnace menu. We want to add the other button objects as this Children, so it's like the three button objects by using the shift key. Then I'll track them and drove them into the Children area. So now all of these objects have Overton parent as their parents. Now I'll open the menu room and plays the buttons and now will close it. Now allowed to create event, I'll add a sign. Variable action. Here I'll create the variable target X and such as value to the starting expedition off. Dying stance, in this case, is where you place it in the room now, while at an event, I'll go in the mouse and select Mouth Center disip entrance when demos and his own stances area. So this way you can know whether the mouse is hovering over dying stars. Now lower the assigned variable action. I'll enter Target X. Here I set its value two X Star plus 24. Now click on Add event. Go in the mouse and select mostly dissident roles when the mouse leaves licenses area knowing that the sign variable action here our Reza Target X two X charge. Now our target exposition is being said correctly, so we need to make the button move smoothly towards it. So for that allowed, the separate meant to make the button moves smoothly from X, which is a grand expedition to target X, which is a target expedition. We need to get the difference between the two values. So we learned that sign variable action. I'll create a variable called If this variable, we store the difference between target, X and X, so as you can see the subtracted X from Target X to get the difference. So now if you add the difference to X, you'll get target X. No, not see if that works. So I learned another assigned variable action here in the name I'll enter X in the value All enter Dave handle market as I'll do so after we got the difference. Well added back to X. So in the end, X will become equal to target X, and that will happen immediately without any smooth movement. So to show you are on the game now, if I hover over double tins, you can see that they immediately moved to the target eggs. This happens because we had the complete difference back to the X now to make it move smoothly towards the target X, we only need to add a part off the difference to the X. So instead of adding the complete difference to the X, we can add, say, 10% of it. So each step, the X will move 10% towards the target X. So when it gets closer, it also moves lower because the difference is small at that point. So this way you get a smooth effect where it starts faster and then slower. So I multiplied. And if value here by 0.1 so now, only 10% off the difference will be added to the eggs. No, I start the game. You can see the double turns are moving very smoothly. Now click on play and the game they start. But if I click on quit, the game ends, so they're set for this lecture. Now let's move on to the next one. We will make our game over screen. 24. F7 - Game Over Screen: Hey there in this lecture will make our game over screen. So on that screen you'll be shown your score and you have the option to play again or go back to the menu. So let's begin. First of all, I'll open the room RM game. I'll go to the layers. I click here to create a new Istres Layer. I right click on it and rename it to G Y. This layer will be used for drawing the game of us green using God. Giorgio, I event. We had to make a new layer for that because we already have a player and a manager. India Stances layer drawing the health and the score. So we have our game of our object in the do I'll ear so it will be drawn above the health and the score. So now we close the room. Now I'll go to objects to create the game of our object. A limit or game over here are allowed. The creative ends here. We need to wear the setting. Stars are for action. I'll set the starting all for 20 so the game over screen started in all 40 and will fade in . So for the fading allowed the step event. Now I want the all far too slowly increase to 0.8 soil additive condition. The variable I jerk is, of course, image Alfa. I have only to increase drew up to 0.8 soil jack ever. It's less than that value. If it is, I want you to slowly increase. So I'll add the Alpha action and attach it to the condition. I'll enter 0.2 here. Antique relative. So now the I'll fire will go up until you're treating 0.8. Now let's draw the game over screen. So for that allowed a Giorgio event. Human need to add this had draw for action. Well, said the offer to Image Alfa. So everything drawn after this would be drawn using guy in my Jafar. Now we also need to address had drug interaction. I let two of them here so the 1st 1 will be used to change the color and the 2nd 1 will be used to reset it. So anything that we draw in between these two actions will be drawn using cutting its color . So, first of all, I disabled, I use all four check boxes if you enable them. The offer from the color here will be used and this whole father be ignored. So that's why we disable them. Vanga using our own Alfa. Now we'll click here to change the color to black. Now we basically draw a big black rectangle tackle filled the screen. So in the actions also attract and at the drawer a tank election, I'll drop it between the color actions. These are the Left and Tobe X and Y coordinates Altera tangle, and these are the right and the bottom X and Y coordinates. We own this rectangle to cover the whole screen so well, said the left and the top 20 The right will be the room bit and the bottom with the room height. We also need to take fair. Otherwise it'll destroy an outline. Now we need to draw some text. So in the actions are such formed an address that phoned action. I'll added after the color is research, I said the phones to FND score. Now we need to change the alignment to center. So I lead us. Had tax climate action. I let two of them so again, the 2nd 1 will be used to rescind the values. So in the 1st 1 has had the horizontal and vertical alignments to center and middle. Now, in between these two actuals, I draw some text. So in the actions Alcide score and add a trolley style score action. I'll drop it in between these two actions. First of all, I'll apply this action to all manager since a score isn't that object dental care in the caption to say your score now for the X coordinate all type room with divide by two, so is only it's a draw in the center. The high position will be the room height multiplied by 0.3 so vertically it'll be drawn at her deeper sense off the games height. Now we need to change the front again, so I'll add another search for inaction this time. I'll Jane. The phones to offend the indicator because I need a small afford now also has draw and at the drove early reaction now in the caption or simply enter press enter to play again, I leave the value empty in the X again, I'll enter room worth divide by two and in the UAE I'll enter room height multiplied by 0.6 so vertically This will be drawn at 60% off against height. Now allow the same action again for his Caption Island to oppress Escape to quit. The X will be the same again. The wife for this would be room height multiplied by zero point silent. Now we'll add another Sodrel fraction. I'll add it at the end. We change the Alpha in the first action. So here we re said, the AL far back to one. No dissident is produced, so I'll go to advance, going to keep breast and slash. Enter disip entrance when you press enter. So in the actions are Surgery Start and Hadari Stockroom action. So when you press enter, the room was simply start. Now we'll go to add event again. I'll go on to keep rest than others and dance like escape, Hear our thoughts, go to another, go to room action for the room A select our menu. So when you press escape, it'll take you back to the main menu. Now I'll open or manager. I'll go to alarm to dislodge bronze one second after the player dies. So currently the game simply star spend a player dies. Sort of glued this action in its place. We want to create an instance off the game over object. I click here and select all game over in the literal enter G Y, which is a little be created for this object. Now, when the game ends, we want to show the creation off any enemies. Enemies are created in alarm born, so we'll have to disable it. So allowed the alarm action. Here I'll set alarm one to minus one, so by setting an alarm to minus one, you can stop it from running until you said it again. Now you also want all the existing enemies to die, so I'll add the assigned variable action. I'll click on the sterile and apply this action toe enemy. Now here also the variable HB 20 so the existing enemies will simply die Now. Finally, around the game, I click on play, and now it's time to lose. You can see the enemies being destroyed as the game over screen fades in. I can no press enter to play the game again. If I press escape, I'm taken back to the main menu where I can play the game again or quit. So the game over screen is finished. Now let's move on to the next lecture. We will implement a higher score system. 25. G1 - INI Saving: Hey, they er, in this lecture, we learned about Iron I files I N I fires can be created from the game. You can write better, too, and I and I file and read it later. They're mainly used for storing settings, but they can also be used to create a basic save system. So when you playing again, you can create an I file and write a value to it. So the next time you play the game, you can open that I and I file again and cut that value back. We'll use this feature to save the players high school in the next lecture. In this form, we learn about the iron I file actions, so let's get to it for this. Have again opened the conditions project. But of course, this can be deterred anywhere. Soil opened the only object that we have ID lead all the events inside it, and no alert the creative end. Here. I'll create a variable. It'll be called a. This is a valuable that we'd be saving and loading using iron I fires. Now we need a way to change its value. So under add event, I'll go to keep rest and select up. I learned the variable action here. I simply increase its value by one and now we draw it. So for that allowed the draw event for this I need the draw value action. I simply draw is value and now we're in The game you can see is value here. If I press the up key, it goes up by one. If I close the game and earn it again, you can see that a gas reset to zero. So that's normal. But with iron I fires will make it so that when you open the game again, it lord the previous value. So to load a value, we first have to save it. So let's implement writing to a nine i file. We'll do that in a key press event for the enter G took out The Ighli actions are such file here. So these are the iron my actions First we need the open iron I file action First we need to open and I and I find before we can write or read a value. Of course, if the file doesn't exist, it will be created Soldier in the fires name to save Dodi and I now lower the right toe in action dissection writes a value to the eye. And I file first of all, our chain that I too number because we're writing a number and not a string. Now this is a section where the value will be saved Soul name it mean And this is the key, which is basically the name off the value sole Name it a And this is a value to be saved. So simply enter the A viable here sort of value off the A variable will return to the eye. And I file in the section with this key. No, We also need to close the and I if I so for that allowed this action. So now this event sure say vase value to save that I and I And now we need to lower the value in the creative and also a trial again, my lad, The open and I file action. I changed the name to save Dodi and I So now we're going to read from the iron I file. So for that allowed a reader and I file action again a chain the type from strain to number No, the section very Seda value was mean and the key was a Now, in case a safe value is not found. This default value would be used instead. So it will be zero by default. And this is the target variable where the value will be saved Full type A here. So the value saved in the section with this key will be loaded into this variable. Now I closed the I and I fired and now we're run the game. As you can see, it starts at zero, which is our default value and now will increase it to six. Now I'll hit enter to save it and then close the game. Now we'll run it again and you can see that it's back at six. So saving and loading is working. We can try it again. So we'll raise it to 10 press enter to save it and then close the game. I run it again and you can see that it's back at 10. Now you might be wondering where the file was saved by an eye. Files are saved under the working directory in Windows. It's under the local ad at a folder. So in the start menu all time. This this will lead me to the local Abbott a folder. Now here you can find a folder for your project, which in my case is conditions. And there you have your savior and I find you can see that there's a section called Main and inside it you have the value off A. So that's what I in my files are never simple to understand and easy to use. So in the next lecture will use the iron my actions to save our high score. 26. G2 - High Score System: Hey, dear, in this lecture of lip Lamento high school system in our game. First of all, I'll go to objects and open or manager. I'll open the creative and here I need to have a variable so we'll create a variable called High Score. So, as you can tell the first or the high score off the player, the high school will be loaded into this valuable when the game ends, and now a lot another variable. It's name will be new. High score on its value will be false describable with store, but it a player has made a new high score. So for that we can use what is called a boolean variable. A Boolean variable can be the true which is one or falls with zero. So right now it's at falls. But if a player makes a new high school with you and you too true so later we can use an if condition to check. If this valuable it's true. Now we'll open alarm to which is where the game ends. So here's what we'll do in this event. Well, Orde the I am. I find we read the high score and compare it with the new score, we write the high score back into the Iron I file and then we'll close the file. So I'll such file here. I'll add the open and I find action. I change its name to save Dodi and I. Now we need to lord the high school. So a ladder Rita and I file action here. I change the type to number. The section for the high school will be game and the key will, of course, be high score. If a high score is not found, the default value will be zero and the target will be the high score. Very about now, we need to compare the high school with the school to check if the player has made a new high score. So for that, I thought if score and add that action, this action basically checks the score against a condition. So we're gonna check what the score is greater than the high score. So if it is greater, it means that a player has beaten their previous high school. So in that case, we're going to make the high score equal to the new score. For that, I need to get score action I'll. A data to the condition dissection applies a score value to another variable. So for that target Islander high score so the dissection, the high score will become equal to the score. No allowed the variable action, I said. The new high school very able to True. Now the high school needs to be saved back into the aisle. I file in cans. A player has made a new high score, so all such fine and they're the right toe in my action. I allowed it. After this condition, I'll turn the type, the number. The section is game and the key is high school, and the value we're saving is the high score. Finally, I closed the Ighli file now will open or game over. I'll open the drawer. Do I events? I go to the part where the school is wrong. Here. I'll draw the higher score as well, so I'll add another draw value action after this one. In the caption, I'll enter high score in the value of Enter the high score variable. But this viable belongs to all manager, So I'll click on the arrow here and apply this action to that object. Now the exporters will be the room where it divide by two. And of I will be the room height multiplied by 0.4. Now we need to let the play and know if they made a new high score. So for that allowed this if expression action Using this action, you can check if a variable is true. Soil added Here first on applied this action to or manager now a jerk. If the variable new high score is true, you know that this is true when the player has made a new high score. You can also see the condition in the overview. So if it s true, we draw some texts. I led the action to the condition. The caption would simply be new high score. The X will again be the room where it's divide by two and a why will be the room height multiplied by 0.1. Now we'll make a small change. I'll go to the part where the enter and escape melodies are drawn. I delete the escape one. I landed in four for both keys in this one message to make it look cleaner and also to end of my position from 0.6 to 0.9 now run the game. I'll quickly make some school and I and you can see that I made a new high score. I can also see my high school here. Now we'll play again and make a higher score and you can see that I've beat my previous high school. Now we're quit the game and run it again. I lose again and you can see that my previous high score was loaded from the eye and I fired. So that's it for the high score in the next lecture will add music and sound effects in our game. 27. G3 - MusicSFX: Hey, earlier in this lecture will add music and sound effects to our game. I have some audio files here. They're five sound effects and one music drag. So it's like them all and track them into gamemaker so they will be added into the project . As sound resource is, you can see their properties here. Now. I close all windows, and now we need to play the background music. So for that, I'll open all manager. I'll open the create event. Here are such audio. I need this play audio action. This action simply plays a sound so here as Lex Snd music. And since it's the music we wanted to loop, so I'll take this. Basically, if you enable this once the audio ends, it'll start again. So it'll keep playing indefinitely until you stop it now for the target, we'll leave it empty. It's mainly used if you want to make some genius student playing sound like the volume page and other things so we'll actually use that letter in this lecture Now if the main game ends. If you want to stop the music soil at an event under other select room and deceive entrance , if the current room is ending before opening a new room or restarting the same rule. So in the actions are such audio and add the straw poll audio action. So this action will stop any audio that is playing. Now we need to play as and issued, which plays whenever someone shoots a bullet. So for that I'll open or bullets. I'll go in the creative man. I'll add the play out your action and in this action play Snd Shoot. And of course, it more Luke, since it's a sound effect now, we're also open mobilised enemy in this creative, and I'll play the same sound effect. So I was like, Effendy, shoot! You will enter our target variable sole name a chewed and make a temporary. So we want to lower the volume off the sound because this is the enemy. That's why we need to shoulder playing sounds I d indescribable soil. Such audio on Addie sat audio volume action. So here I went to the target name for the sound. Now, one is the full volume soil until 0.3, which would be 30% off the full volume. Now we need to play the snd explored sound. It plays the never a shape explored. So for that, I'll open or explosion in the creative and are simply played a sound. Now we need to play the S and D power up sound. It plays whenever the player collects a power. So for that I'll open up. Our parent object here allowed any man's. It would be a collision event with the player. So since this is a parent object, this event will be added to all the Children as well. So I'll simply played a power up sound effects here. Now we need to implement these two sound effects. Snd overplays when you hover over a menu button and snd Click plays the new click on one. So for that I'll open the menu group and open orbiting parent. I'll open the Mouth Center event here, allowed the play out to action and play the S. And we have a sound. Now we'll go to advance and under Miles allowed the left breast revenge. Here I'll play the click sound so the click sound should be working. But currently it won't let me tell you why I'll open a child object off the Burton Barrett . You can see here that they have a left president off their own, so the actions in the parents event will not run here. That's how parenting works in Game Maker. When you were at the same event to the child, the parents event is ignored, but we can still make it work. Soil opened the event in the actions are such core pan into, and I had the action at but all. Basically, this will run the actions in the Pirates event so it will not be ignored anymore, and as a result, the sound effect will be played for all the evidence. Now I look on the other, but in objects and do the same there. So the help button doesn't do anything. So be Tony to change anything here and now we'll do it in the exit button. Now run the game. You can hear the Hubble sounds here and there, and now you can hear the music plane. And there you have the shooting, an explosion sounds and a power upside here can do. Now let's continue to the next lecture where we learn about building and execute herbal, and after that we'll have some cool features to the enemies 28. G4 - Building an Executable: Hey there, in this lecture of you're going to build an executable off our game, you should know that this is not possible in the trial was him. So let's begin. First of all, I'll go to options and open windows. This is where you can enter information about your game. This is the title off the game window. So I'll enter Name here. This is a name off the games as a suitable or the X. If I you you can change the water number off the game. And here you can enter the company, name the product the appropriate in full on the games description so quickly until some in four and now will open the image of section. This is where you can select an icon for the game, but it needs an aiko file. So if you have a PNG or any other image file, you have to convert it. You can actually do that online through the many sides available. So once you have your profile ready, you can import it as you Aiken. So now this Aiken will be who's 40 executable, and now we're hit. OK to save the new info. Now you can click here to create an executable off your game. It'll be a zip file so you can change its name and save it. You can see the progress here and now it's done. So I'll open the folder were safe, does it file? And there it is, so I'll open it. So there you have the X. If I so you can open it and play the game, you can also see the icon and the games name here. Now, if you're wondering where to share your game, you can create an account on each Io and applauded there. That's where I post my games, too. And now let's continue into the next section. We're really had difficulty scaling to the game. 29. H1 - Difficulty Scaling: Hey there in this lecture, we're going to add difficulty scaling in our game. Basically, our game is an infinite scholar, so you can keep link indefinitely until you lose. So after some time, the game will become boring. The enemies will keep coming at the same speed, and you will keep shooting at them. So we're going to make a challenging. We want to make the game harder as it progresses. So for that we let a variable called difficulty when the game starts, that labour will be at one and its value will keep going up. But slowly now the speed off the background and the enemies will be dependent on this difficulty viable. So when the difficulty variable regions say true, the enemies will be going at twice the speed. So this way the game. Berdovsky becoming harder. So let's begin. First of all, I'll open all manager. I'll open its creative ends. No, you allowed the variable action. I'll create the valuable difficulty with a value of one. Now I'll add the step event. He will increase the value off the difficulty valuable. So I learned a valuable action in the name. I'll enter difficulty in the value all in 20.3 and take RATTO. So as you can see the difficulty, why able will go up by this very small value so that it takes some time to get harder? Now we need to change the background speed. Bet on the difficulty so far us. I'll open a game room to check the background speed. Also, remember the name off the background layer, which is simply background. Now I'll go here and you can see that the backgrounds vertical speed is four. So we'll simply multiplied this speed with the difficulty variable. So I'll go back to the object now. Now there's no action for changing the speed over earlier, so we'll need to use a function. A function is like an action. It takes some input values and performs in action and use usages like a script where you have to specify arguments. Functions are actually used in quoting, but you can also use functions in jack and draw using an action. So in the actions are such function and add a function called action. Now you need to write the name off the function, which is layer underscore V speed dysfunction genius A vertical speed over there. Now, in the first argument off the function, we need to specify the name off earlier that year, mortifying so all time background as a strange. So make sure you don't forget the Kardashian marks. Now we'll click on the plus sign here to add another argument. The second argument needs to be the vertical speed. So here I'll enter four multiplied by the difficulty value. So now the vertical speed off the background layer guilty and to be until now, difficulty variable. And now I'll open the drawer. Do I rent here will draw the difficulty variable, but only for testing. Now this is where the school is wrong. So after this allowed the draw value Action Force all said the caption to death and then in the value Atlanta difficulty. The exposition for this will be the same as above and of I will be 60 so there should draw the difficulty value. But this is not something God a player needs to see, so make sure you remove it later. Now we need to apply the difficulty to do three objects the islands, the enemies and the power ups, soil open or island and go to its creative, and you can see that it's political speed is for no allowed the step events. You allowed us that speed action first, all genotype toward a girl and then in the Speed Island to four multiplied by. Oh, manager door difficulty. So the island speed will be based on the difficulty variable as well, and I typed or manager daughter before the valuables name shows the variable belongs to all manager. Now I'll open or any me and do the same here. I'll open the creative ends, and you can see that the vertical speed here is to. So I'll open the step event and at the same speed action just like before. I make a dependent on the difficulty very about, and now we'll do it in no power parent as well. I'll open the creative and on its vertical speed is true as well. So in the step event, I'll do the same. So around the game and play it, you can see the difficulty value here is going up slowly, escape ahead, and now everything is faster. You can see it in this comparison, you know. And now let's move on to the next lecture we will make. The enemies move was only 30. H2 - Enemy Horizontal Movement: Haider Indus lecture will add horizontal movement to the enemy's. Basically, they should be able to move us on plea towards the player to make the game more challenging . So Alaska tours for this, Of course, I'll open or enemy. I'll open the step event and go to It's very bottom now, before moving the enemy towards a player we want to check. Your top layer instance exists in the room. So for that, all such exists. I need this. If instant exist action, I'll add it after the last condition and not inside it. Now this action simply checks if an instance exists inside the room, sort of like here and Select or Blair. You can also see the condition in the action. Overview. Now, if the player instance does exist, we want the enemy to move towards it, but only on the X axis. So all such for an ad, the variable action I'll attach to our condition now here, all creative able called deaf. This was told, the difference between the players X and the enemies eggs. We're going to use this value to make the enemy move towards the player. So that's what the players X comes first in this attraction. So if I add this value to the enemy's X, it will move immediately to Dubliners. Acts, so to move it there. Gradually, we learned the value signed to the X. The sign off a number tells whether that number is positive. Negative or zero Swift response chip. The sign is one. If it's negative, the sign is minus one, and if zero the sign is you as well. So we get the enemy's existence. Stood a player under the user to either one or minus one. This value will then be added to the X so that the enemy moves towards the player. So I'll add another variable action for adding to the X soil. Enter X year anti grado now in the value Uhlaender sign and inside the brackets are entered . If the sign here is a function and we're passing the diff value as the first argument, so the function will return the sign off that value, which will then be added to the eggs. And now around the game I played and you can see they're the enemies. No moved. Worse the player. So this one was easy. Now let's move on to the next lecture. Very lad. Mobley Airships 31. H3 - Player Ships: Hillyer and this lecture will add more player ships to the game. You will be able to select any one of the ships in the menu and then play with it. So let's get to it. First of all, I'll go to strides and open s clear. We need to import the other player images into this one's bride. So I'll click on Import and go to my images folder. Here I have these three ship images, so I'll select all three off them and click open. They'll be added to the stride Aesop images now once had the speed to zero so that it doesn't enemy it. Now I'll go to objects under menu will create a new objects. A name it. Oh, Manu Manager, This is just a background object for them. A new rule? No, in the object allowed the creative and and here are allowed the variable action. Now, let me explain the difference between an instance variable and a global variable. When you create a simple variable using this action, it creates and installs variable, so you can only access that variable as long as the instruments isn't that role. So if you destroy the instance, orgy in the room, the viable will no longer be a credible. So if I make a variable in the Manu Manager object, which only exists in the menu, I won't be able to access that viable in the game room. So to do that, we have to create a global variable. You can access the global variable from anywhere at any time after it was created. So even after the instances destroyed, you'll still have access to the global variable and to create a global guy. But you have to type global and thought before the valuable name. So we'll create a global diable that was sold the imagined X off just like that ship. So I'll enter the valuable name here and now we'll go back to objects under manual, create an object and name it or ship selector. This will be used for selecting a ship image so the subject would have the players bride. Now we'll open them in your room. Here I'll place an instance or for my new manager and now a place in stances off warships, Elector one for each year. Now we'll double click on the second instance. These are the instance, Properties now here all agrees the frame off this instance, also known as the Imagine Debts. And now, for the third instance, us like that hurt frame. So these are instances off the same object, but they're drawing different images from the same pride. I also increased like ass between them. And now I'll close the rule. Now, back in the ship Selector object, I learned the most let press event here reborn dis instances. Imagine decks Toby applied to our global valuable. So allowed the variable action in the name I'll into the global variable on in the value will enter Imagine debts. So that's where you can change the selected Imagine decks. Now we'll add the play audio action. I click here and play the S and D click sound No allowed the step event Now here. You wanna check if this instances in made index was selected? In that case, you said the Alpha Tau one otherwise deal for should be 0.5. So Aladdin if condition the variable will be checking is the global player imagined X variable we reject If the global variable is equal to distance sciences, imagine debts. So that means that this ship image is selected. So in that case, are simply, said the Alpha 21 and now we'll add the L section. So if the ship images no selected all said the all 4 to 0.5. So this way the selected ship in marriage will be highlighted. Now we want a global guy able to be used by the player so open no player I go to its creative AM's now here allowed the variable action at the top of the event here are said, the emergent X variable and its value. We built a global player imagined X. So the 1,000,000 tax that you selected in the menu will be applied to the Players Image index in the game. So now run the game. You can see the tree player ships here and that the 1st 1 is selected. So it's like the 2nd 1 and hit play, and you can see the selected ship in the game so the future is working. But there's a small bug. If I got the speed power up, you see that the trail is still using the old image, so we need to apply the global imagined X to the trail object as well. So I'll open, hopefully a trail and go to his creative and we'll do the same thing here that we did in the players create events, so that's like that. Imagine decks will be applied to the trail as well, and this eliminates the bug and no whatever challenge for you. If I select a ship, then closed again and then run it again, it'll be sent back to the 1st 1 So your challenge is to save the selectively mating decks two and I and I fine and then loaded in the creative end off all Manu manager. This way, the game will save the player selected cheer. So if you face any issues doing that or have any questions, do let me know. And now let's move on to the next lecture.