Making an Action-Adventure Game with GameMaker Studio 2 | Gurpreet Singh Matharoo | Skillshare

Making an Action-Adventure Game with GameMaker Studio 2

Gurpreet Singh Matharoo, GameMaker Mentor and Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
48 Lessons (2h 19m)
    • 1. A1 Intro

      4:53
    • 2. B1 Player Movement

      3:26
    • 3. B2 Animation States

      4:33
    • 4. B3 Run & WASD

      2:58
    • 5. B4 Attacking

      3:27
    • 6. C1 Camera

      2:18
    • 7. C2 Object Collisions

      4:07
    • 8. C3 Tiles & Autotiling

      3:20
    • 9. C4 Tile Collisions

      1:58
    • 10. D1 NPC Template

      3:34
    • 11. D2 Skeleton Movement

      4:17
    • 12. D3 Skeleton Attack

      3:11
    • 13. D4 Skeleton Knockback

      1:29
    • 14. D5 Skeleton Death

      2:11
    • 15. E1 Player Health

      4:47
    • 16. E2 Stamina

      2:44
    • 17. E3 Data Structures

      3:10
    • 18. E4 Inventory Concept

      1:22
    • 19. E5 Inventory

      4:39
    • 20. E6 Interface Drawing

      4:33
    • 21. E7 Item Selection

      4:07
    • 22. E8 Item Effects

      1:54
    • 23. F1 NPC Movement

      3:31
    • 24. F2 9Slice

      3:19
    • 25. F3 Textbox

      3:23
    • 26. F4 NPC Dialogue

      3:25
    • 27. F5 GUI

      1:22
    • 28. G1 Houses

      1:08
    • 29. G2 Doors

      4:47
    • 30. G3 Camera

      3:16
    • 31. G4 Saving

      3:03
    • 32. H1 Blend Modes

      4:11
    • 33. H2 Cycle Concept

      1:39
    • 34. H3 Difference

      2:11
    • 35. H4 DayNight

      4:44
    • 36. H5 Lights

      2:27
    • 37. H6 Bugfix: Item Menu

      1:16
    • 38. H7 Shadows

      3:41
    • 39. I1 Pause Menu

      4:03
    • 40. I2 Saving

      2:07
    • 41. I3 Main Menu

      1:55
    • 42. I4 Loading

      2:43
    • 43. I5 Bugfix: House Exit

      1:30
    • 44. I6 Menu Mouse

      1:36
    • 45. I7 Audio

      2:24
    • 46. J1 Hit Cooldown

      2:13
    • 47. J2 Gamepad

      2:35
    • 48. J3 Conclusion

      0:22

About This Class

Hello there! Welcome to my class.

♦ About me ♦

I'm Gurpreet Singh, a 2D indie game developer and instructor. I have years of experience in making games in GameMaker Studio 2 and I want to teach you all of that through this class.

 About the course 

This class is all about creating a 2D action-adventure game with GameMaker Studio 2, from the ground up.

You'll learn a lot of advanced coding using GameMaker Language. Here are a few examples of what we'll go through:

• Data structures
• Auto-tiling and tile collisions
• Finite state machines
• NPC movement and textboxes
• Making houses and going inside them
• Saving your game and loading it
• A day-night cycle using blend modes
• And much more!

 More about the class ♦

This class is beginner-friendly, however it also contains advanced concepts. It is beginner-friendly in the sense that I explain everything I do so that no one feels lost. The advanced concepts allow you to do more in GameMaker. So, you can take this course regardless of your skill level!

The style by which I teach is to-the-point without any filler or unnecessary talking. I get things done quickly while explaining stuff comprehensively.

So join in, and I'll meet you in the class!

Transcripts

1. A1 Intro: Hey there, in this lecture, I'll give you a basic introduction to again. Make sure you do and how it works if you already know the basics. The new miscarriages lecture. After starting gamemaker, you can click here to create a new project. Now you can select whether you want to create the game using drag and drop or by according with chemical language, for discourse abusing the latter. So I click here. No, your project has been created and opened. This is a workspace, and this is a resource. Is bar you'll be creating resource is to build your game. They're created and listed here while they're added and builds here for creating Are you source. You can hardly cornets folder and select this option. The basic workflow off getting a game and gamemaker goes like this. You make us pride, the nuclear an object for that's right, and then you place that object in a room. Now let me explain the steps one by one, a sprite is an image that is used for an element in a game. For example, you can have us pride for a player, a coin ah, house and so on. It can also be an animation with multiple images or sub images. An object is word and compresses all the logic and behavior often element in a game, so you can create an object with a player, sprite and quarter to move, jump and attack all inside the object. A room is like a level of the game where you can place the objects, and that is how they appear in the game so you can create multiple rooms if you want more than more levels. Now, let's go back to the objects I told you that you can call the logic and behaviour often object. But how does it work to make it easy to understand when Sergeant court should run on the court inside, an object is divided into separate events. You can add any events from this big list of events to run court at certain times. For example, if I had the creative end, the quarter right here will run only once. When the audit starts working, the step element is the minimum it because it runs all the time, once were frame. So, for example, you can call the movement and the rest of the behavior here the droid mint is just like the temperament, but it's used to draw things like a Sprite, Ah, health bar and so on. Then their money conditional events as well that run when something specific happens. So the keyboard events run when some key is pressed. Duck clear, never concerned when disrupted, collides with someone an object and so on. You can herd cordons hard these events using G. M. L or chemical language. Let me explain the basics off. Courting is in G M L. Oh, very able is used to store of value. So in the creative meant I can create a very able called A and 32 5 You can give any name or value to ever able in the dry vent. I'll draw this value using the drawbacks function. This is a position where they really will be drone, and this is a value to draw. I'll place the objects in the room and run the game. You can see that it chose five here, which is a value off a now will open the step event and here type A plus equals one. This means that the every able should be increased by one each step because of the blast symbol before the equal sign. Now, if I run the game, you can see that the value keeps increasing. Since we put the court in the step event, it increases once per frame. The default speed off a game, a star difference per second so they were able is going up by 32nd functions are used to perform some action, for example, have used a door text function. Here we draw some text each function used to have these parentheses at the end. Depending on the function, it may require some data to be able to perform it section, just like the DOT exe function requires a during position and devil you to draw depending on the function. It smells horrid on a value that you can store inside a very able soil. Open that a parent and tied this year, the function, her own drones, a number and her don's a result. So the function would round 2.8 to 3 and it earn it data. It on value would be stored in this variable called B, so the value of B will become tree if conditions let you run some called only at specific times when starting conditions are met in the step even allowed this. This is really simple. If musical 23 it was set a 20 So, basically, if the conditioner than here is true, then the court inside these records will run. We know that B is three, right? So it will be side 20 in conditions of use. Diabolical signs to check with the two values are equal, while views a single equal sign when assigning a value to ever able. No, If I run the game, you see that is value appears at zero because of the condition. If I change the condition to check whether bees four, you'll see that is nor effected at all because their condition becomes false and discord does not run. So they're sold for the introduction. No, let's start working on our game. 2. B1 Player Movement: Hey there in this lecture will start working on our game with the most important thing. Blair Movement. There are two parts off movement input and the movement speed. So this dilatory game we need to excess X, which is arrundell and why? Which is vertical in game maker. When you add two eggs, the object moves right if you subtract pro mixed object moves left. Similarly, when you had to wire, the object moves down. And if you subtract from why it object, moves up so we'll say goodbye in port in a similar manner. Then put your people if right or don't expressed and negative. If uproar left express, so we'll create very Abel's input. Extra input. Why with this Jordon put for both access will use a function keyboard check to check whether the Iraqis are being pressed for the movement. Implicated variables Move ex and Move I, which we showed the speeds for board taxes will create a variable called most feed, which will store the speed at VW. Should move the variables input. Excellent, Good. Why will be multiplied by more speed and the product will be stored in movements and move. I then finally move ex and move. I will be added to X and y to move the object. And now let's move to gamemaker. I'll open the pair object and our do creative int The court investimento runs when the subject starts working. So it's a good place to initialize or create all over Abel's object needs. Hero diaper government gold properties a. Committed just some basic text that has no effect on the court. You can type a comment by starting a line with two slashes like I've done here and below this comet. I'll type more speed because to so this will be just pick it up later. Move edge, annoy. Let a comment named variables and here little eyes move ex and move I bought at zero. No wonder does that prevent? This is only one that keeps running as long as this object is active. So this is where we make our movement. So, first of all other day input court so allowed to comment Golden Boot. And here I'll create to local variables in politics and input bite. Local variables are initialized by using the var keyword these air variables that are usable only it wonderment and not leading from memory. When the defendants, for since we only need to input values in dissident and not actually to store them will save them, we'll use local variables. So here alert this court. The keyboard TechCrunch undertones. One if the case pacified, expressed and zero if Ducky's note breast, when protects, will become one for the right key and mines one for the left and input why we become one for the donkey and mines, one for up. And, of course, if nobody expressed Delgaudio a. No alert this, this woman replied. I input variables by more speed and storing the resulting move ex and move I and now finally allowed these variables to X and Y. This will make the object movies on nine. Put no for testing. I'll open the room, and when the room opens, I'll drag oh, player and place it here. No, I run the game. I can click on display button or press the five key on the keyboard, and when the game starts, you can see that you can move around using the arrow keys. Now let's move on to the next lecture. We will anyway, the player 3. B2 Animation States: Hey, there in this lecture will implement the state's inanimate a player. The state of the player will be a very able called state that list organs chaired a players in There can be many states such as idle move, attack and so on. All of these spirits will be carry inside and Nina, just basically a group off numbers number in descending order so you can set the state. Were you able to a member of guardian, um, to set the state in the step event will earn a switch. State man doubled on different gold bears on the state. Here's how less waste treatment works. Let's dig this if statement If Stare decider, the first court block will run. What if it's moved? The second court block with you can create the same cold using us for a statement like this in a statement, according side Okay surrounds if the value of the variable here is equal to the cases value . So here, if stared is idle, discord will run. And if it's moved discordant, you also need a break when a kid scored ends because if we don't use it, the rest of the guests will be executed as well. The break basically marks a position where the case ends. No for this prize for get out of the area that Lasorda's right for. He stared any direction so they are for directions. A state will have forced brides for the directions. Will be using zero for right, one for up to four left entry for down. That's because in gamemaker direction, zero is right 90 years up. One of these left into seventies down. So if you divide these values by 90 you can't use numbers. Any values in between will be floored. Lastly, Will said, the state of the pair object and the direction of air it is moving and using those values like appropriates right from that. A. Now let's go to the guarding. First of all, open the great event of the player and are the states comment? And here are the states are getting Denham Gold SD inside. It's great to members Idol and move, so these are not. The stairs will create and create a variable called state and said it'll SD idol. Now we're created to dear, a dull containers applied for each stating the direction. So here I have four strides for each state Heartland move. So in the event I learned this. So this is a sprite. Say that Jodi Arias told that I, using to access in the 1st 1 will use a state in the 2nd 1 will use interaction. These are the straits for died illustrate and these were the moved it. Nicholas by directions are in the same order as mine. No, I'll open the step event and added switch treatment here without a variable in its parentheses. I'll put Kali brackets around all the gold in that event. Collect all of it, then press tab twice. I love the case here for S. Gitell. Under the end, A break for no other player, state investigator, this courtroom. But I also want this court to run when it's moving. So I learned another gates here for rest removed. Not this coordination with last year's idol or move Now, at the end of this case scored, I learned this the function AB spirit on the absolute posted value off a number. So efforts in negative numbers say my three Elarton opposed to value tree. So I'm wearing metal values or move X and Y and testing whether they are equal to zero. If the ah zero, that means top Layer is not moving so well, said the state tost Idol. But if it's nor Deer Odendaal, Spartans had just dared us to move. No, it's of the interaction with the players moving. So in the create event under variables, Alicia lies bo dear at zero. So this variable will hold that, I reckon, for this bright No, it's harder step event are dead. I learned this. If the players moving, Daniels had moved here to this. This point action function without the direction value off the player's movement in the direction will be divided by 19. The reason I'm using deal is because it automatically floors a result with flooring values around it down. Some 1.3 will become 12.7 will become two, and so on. Now, outside of the switch statement, I like the score. Despite index, it's us right over the object, using the state and the moving direction. It was like the sprite from Dari and said it will despite index. So now we're in the game, so you concede it up later in the Kerekes Bright for a state and direction? No, just continue to a next lecture. We will make the player able to run and at W as input. 4. B3 Run & WASD: here, there, in this lecture will make doubly able to run on AWS import. No, this is something important that you need to do for every moving object, their contingents rights. A mask is what defines a Canadian box. Often object. Senator Player has money. Jenny expires. We need to define one starting mosque, worried and assigned to the object will also enable running by holding the shift key. We could dine, bulldozing, keyboard check and a variable called run. None will be one if you've expressed and zero When it's not Denver, multiply the movement spirits with one plus front. That's because of money. 01 plus one will be one, so multiplying the movement by one will have no effect. What if one is one? One person will come to doubling the movement. Speed relatable years input as well. Input from letter keys can be taken using the hors d function like this. This will check whether w expressed or not. So now let's move to gamemaker. First, I'll duplicate the island's pride and then dragged and pleasure that all then with F to our intimate toe s player mask. No, I'll open it and go to regulate in math section and turn this to manual Now from here I make a shorter and now our closes now local, no player and go to a step event at the end of this case is called Allowed This So this one said the mosque for the state now will implement the running. So after this input court, I learned this. So in the very able run it was stored by the shift key is being pressed and here are multiplied them will speed with one plus run seven shift expressed The movement's speed will be the boat And here, where the state is being said to s remove allowed this So if top layer is earning dime, a spirit will become one point file as one will be one and divide by two it will become 0.5 . So why increasing the inmates speed? We can increase the animation rate Now let WSJ in port I'll go to the input court and add parentheses around All these keyboards are functions inside the parentheses own dysfunction alert days. I'm using all to check whether d alright express so collectively this part within one. If either do your writers press So for the import, Goethe duckies will work now a copy and paste this in all parentheses. And Jane, them toe s for down here for left and w for up. So not only are the keys should work just like the arrow keys. I run the game and now I'm able to control the player using W tikis as well as the Iraqis. And I can run by holding the shift key. You can see that a player is moving faster and knowledge slower. No. Let's move on to our next lecture of ever made the attacks date. 5. B4 Attacking: Hey, there in this lecture will are the attack state. First of all, we learn in the state in Augustine, um called attack and heard sprites for it in spite Saray. Then we'll check the input from the space key and if the key is pressed to industry eight West Iraq. We learned a case for the attack state in the sweet statement on unit said the marks to recurrence, right? Yes, we were using a tragic mosque in the other states before tacking. We've owned a player soared to really contend account. It's always had that mosque index to those writing necks. Then, using the animation and event agenda stayed back to SD idle When the state is us the attack . No, that's moved to gamemaker. So here I am imported all your tax prides when you import them, make sure opened them and change of speed to dwell. So now I'll open the pair object in degree element Here I learned the attacks date and now we're the sprites here. Cooperative spot despite its for the most it and hated blow it energy and all of these two a deck and Jeanne displayed names to attack as well So here I start W sprites for your tax date. Now we'll go to establishment and after input code, I learned this. I'm using the keyboard tech press function instead of keyboard check because this one, it turns true only when the key is for expressed. Instead of being held. No one have to switch you to extend, if this way. But it is true but forced you to read a script. Let's create was like a custom function that Condoned some court. So we'll make us kept forgetting the state. I'm getting escaped because on average, in the state, I want that image index were able to use it to zero. The variable holds which animation frame the spiders on and, of course, would want admission to reset of energy industry it so alertly conscripts and create one unnamed. This state set first a list arguments that we need for the script. So here I'll type tree slashes, then type at Arc and then typed argument name State. We only need one argument for descript. Donald had stared equals argument zero. So it'll use the first argument passed into a script and Saturday to the state. Then I'll start em index equals zero. No NWS step event at dined off This case alert this slow space expressed The state will be chained to ask the attack. And when the status change my main this will be side as well. Knowing this which I learned of the case for us you attack and also a break And here I'll send the mosque index to aspire your next. And also they may speak to one. So when you just dare to Jane, back toe idol When I drag animation ends solar than any mission and event which is inside daughter category As an introduced This event runs whenever the animation ends. So here are our def so you can see it is also a statement similar to the one in the establishment And here I only have the attack case. So when the animation ends and the state to the sea attack will be said Tost Idol So now we're in the game and I can attack with the space key in any direction. This project is automatically using this court which guards occur expired from this very using local and state and the direction Now let's move on to the next lecture 6. C1 Camera: Hey there in this lecture of Willard, A camera to a game. Most games use a camera to fold up. Play around in a big world. There's a room so many the camera with of it and the height that will hold up. Player. We'll also have a scale variable Donatella scale of the game in tow compared to the camera size. That means that even though size will be the camera size multiplied by the scale, so let's begin first record on you object called Oh manger, this will be a back on object for managing important stop in the game, For this is where village allies are Camera. I'll open it and other creative int inside it allowed discord. So this sold. We knew to initialize the camera. Let me explain the score line by line, this level of use and this will make the first view. You zero visible cameras use viewers, so you had to turn that one first. These variables are covered and height of the camera, and this is a scale I've had 22 for the game in those science will be two times the side of the camera. The dysfunction required the camera and started told this local variable camp. This is the position of the camera. This is a size, this is a rotation, and this is objectively for low. Since I've said this to a player, it'll follow up player. Then these are the maximum speeds, and I have put Miles one here because I don't want them and some limit on the speed. And this is the minimum distance between the player and the edge of the camera. So since I've said data camera size divide by two, it'll make sure that a player stays in the center. Then this was that the camera to view zero. So this will enable a camera this inside the window size. As I said to the camera, science multiplied by their scale. Then I'll apply the same size to the application surface. This is basically that a solution of your game, so you have to start this as well. So what? This on camera set up, I love in the room and place home angel here before us. Before testing, I'll open the background layer and you'll despite here and enable tiling. I'm doing this because we need a background or notice how the cameras moving and this is the better. And I'm using so in the game. So now you can see that the game is focusing with a player and falling that her own wherever it goes. Now let's move to the next lecture. We will called the collisions. 7. C2 Object Collisions: Hey there. In this lecture of implement all the collisions for object religions, we first need an objective collide with the maybe men different kinds for object that going collide with like walls, rocks and much more so money to create a parent object that will have all these collectible objects as its Children double check for Christians against that parent. We call that a parent object or collusion done. It will create a script core collision that will check whether we're colliding with a collision. We could just use a function place meeting for that, but we'll get escape for their recordable mental collisions. In other lectures, they're skip predictor arguments. Excited, Wired. They're the values that need to be added to the extrapolation of the player to check for a collision. This survey contract, whether there's a connection to be found with a player, is moving by passing, move, accent. Move I to the function, then finally will bloom in the collisions and a player. There will be two collision jacks, one for the horizontal movement and one for the vertical. If a collision is found, move excellent. Well, why will be set to zero? But there's a problem, said. A player is going to the right and there's a ball to read A players moving, so it'll stop. But there will be a gap between the ball and the player. We need court to moved up their closet or of oil before it's jobs. So if Uncle Junior's phone videos on my look to check whether there is no collusion, immediately flex with a player where it is moving, if there is no collision, that player will move slightly in the direction it'll keep doing so until a collision is fallen. So this way there will be no gap end up players jobs. So now let's move to gamemaker. So under objects, I'll get a group a name it world. I'll get an object here and call it or collision. So this is a plan for every collateral object. Fennel green objects called a wall, and you'll just right. So I looked uninspiring window and here, underworld palace like Oh, collision. So no, no collision has been said as his old experiment. So under scripts, I get a group gold religions, and here I get a script called Collision and here, first of all, outside of the arguments. So these other two arguments discreditable need, as you can see him starting the variable names for the arguments within under school. I do this to distinguish argument variables from normal variables and now alert this. This will check for a collision with a collision by adding exciting. Why are to the restart escalation? So this will take that your eternal for collision into account as well. Then we start a result off dysfunction in the local variable over recall, which will be the true or falls, then the script bullet on that very bus value. So now will implement that collisions in my player objectors in the script for all. Open up later object and I'll go to the establishment. So I need to check for collisions and set, move, wax or move by 20 before the I 12. Some way so before this part on our decorations. So the first part of the whole entre collisions and the second part is the vertical and the horizontal part recheck for a collision using only move X. If there is a collision, this why Lupron to bridge the gap between the player and the object. It's gliding with the function signed returns one. If a number is boy, studio and mines one. If it's negative, so it project for a collision, one pixel away, and if there is none, it will move towards that direction. It will stop when you're finds a collision. Genitals had move XO zero to stop the movement saying will happen for the vertical part instead of using more works, it really does move by and add y to bridge the gap That set move by 20 No, for testing ill upon the room and place Instances off all around here also know that you can resize An instance. Took over more area. It's no wonder, no game, and you can see that a player can't move if there's a ball so the religions work. Probably let's continue to a next lecture. We will make that I sense 8. C3 Tiles & Autotiling: Hey there in this lecture will, at times in our game, wheeler to time sets. One will be a back on trial said, with grass and dirt, and the other will have walls. Game makers were, too. Hasn't trialing feature. It means that you don't have to place east. Tell yourself there's this order tiling template. You can assign your ties to dis template ahead of a lot of medically. Players are correct tiles for you in the room better so no one has got to get maker. First of all, you have to import your times. That's right on despite. So I have great upholder and described cold tile sets. And here I am bored Estyle Background and Estyle Walls. So these are displayed. Supposed to fall appeared, I said, When the time says I get a new one and name it deep background. I regular back on my list right here. And make sure that size here is 16 by 16. It is a correct size for this time set, no acceptable dialing. So I click here to open our darling window and click here to read the 16 tile template. So now you have to select the correct tire Ledford seat piece. So, in our case, the white part in this temple it should be the grass and the great parts will be adult. Putting. The first piece is full grass that's like the grass peas here enough Like all the correct tiles. It's no daughter. Dialing has been set up, so I'll upon the room and Colliers Ugly Contest button to Peter Dilulio. I'll press F two and named. The styles underscore background, so this will be our layer for the background tiles. I'll go to the panel here on the right side. Click here and select their style. Set Morgan Zoom here. It's like a tile. Celeste pictographs talking and selector. Piltel here and fill the room with the grass. I also go to layers and move this style layer below Die taxes layer. So now you can use this ordering tool here to place the grass with the left, click and adult with the right leg. No. One or double it. I'll said Sana tile sets. I'll get a new one and never tables us like this right and drop it here Now the size for their time said it's eight by eight nor testing by 15. So make sure change it here. I love another darling menu and other 16 Thailand blade. No, here the white part will be the wall, and the great part should be empty. No, when it comes to a last tile. Don't like this or any other day, I'll make sure the last style is the 1st 1 here, which is empty, or the religions would work properly. It's not all the tiling for this time said You set up but upon the room and Peter Otylia here using of to name it tiles, walls and basic adjustable that ice back only in the right panel. It's like the ball drives it and using the order darling tune. I can place walls here. So now we're in the game and you can see that the game looks a lot better now where, of course, you can collide with the times yet, so in the next lecture will implement our collisions 9. C4 Tile Collisions: Hey there in this lecture of little Amanda, collisions for colliding with tires will use a function tile mab get at pixel. It gets the idea off a tile at a position a pitted on zero. It means that there is no Tyler that position where if there is a trial, it will adorn its psyche using dysfunction. Reject. Where there's a tile at every corner, off banks, Chances mosque. We can cut the positions of the mosque corners is not be able for a burst with short of provisions off each edge of the mosque. So now let's get to gamemaker. I'll open or Manager add in a scared event at the end. I learned this so the flu cotta tile map would've all year and stored in this global variable. You need a dial meant to be able to check for collisions. Also, make sure the name you put here matters are name of the layer in the room itself. No, I'll open scripts, unopened operation script and after all, decorations allowed this Here I have four tile mob gathered pixel functions joined with or the 1st 1 will check pro tile at the top left corner of the eye stances Mosque. As you can see, be books left and door being use here. The 2nd 1 will check it out. All right, Corner that heard one would check on the border right corner and the last one we check at the bottom left corner. You also see that I'm adding X ad and wire to all of these coordinates, just like the place speeding function. So if what I'll is found at any of these coordinates, tired cold will become true else it will become false. So after district on here, I lad or tile Coal. So this grateful it on. True, if I drove, these variables are true. So now we're in the game. And now you can go and collide with of all tiles evoke just like the gecko aliens. So you can place any time anywhere, and the Canadians will work. So let's continue to our next lecture. 10. D1 NPC Template: Hey there in this lecture will start NNPC management in this section will be adding any me to the game. They'll have some of the behavior, like moving around. Jenny expires colliding and so on. So we create a template object that will have all the basic cold for Old and Percy behavior . Then, when we have to make an actual PC or enemy, will duplicated busy template and edited so that we don't have to take the same coat over and over again. When you have many stances, the not top down game that move around you also need to manage their depths. The depth is what tells which instance close about whether restaurants is, if one instance has a high def value, will be drawn below an instance with a lower debt value. So, for every instance, well said depth to my house to be built bottom. Here's how this will work, say the artillery instances one with its people support him at 50 and one, that party, the ducks will become my 50 animals 40 So the lower one, the one with the minus 50 death, will be drawn on top of the one with demise for your debt. Bourbon dynasties had 50 moves forward and ends up at 30. It's depth will become my A 30 will appear below. Daughter is tasked with minus 40. Depth in the original script will add conditions to check whether the operation with the instances moving is are tired of the room. Listen, make sure that a player or any NPC doesn't go out of the room. So let's get to gamemaker. First of all, under objects are getting the object and name it. Oh, NBC template. Replace it with a player at a very different in here. A lot of this. So as you can see this weird similar to a player scared event, these are old. Every burst has sorry for NPC. So that's why I'm urging them to dis template. If you want, you can just copy the similar parts from the player object. No wonder the document and he other this Let me just move this here so you can see. So this is just like the players step. It went as well, so you can just prop it up a little step court and make the changes you're inserting, then put values to zero because is NBC code? It doesn't require any input? No, it closes. And there the other. Any mission and event and here learned this. So there was just like no player as well. So no dynasty template has been set up no local nor manager. And at the end step event, he allowed this using the word function. You can some court in someone dying stance So sometime is in the old keyboard here, it means that the gold falling dysfunction will run in all of the entrances. So in older stances, that depth will be set to minus people export. Um, and I'm doing this and I'm step event because this is a very in veterans after the separate and before that drive it so that that will be changed after instances have moved in a separate and have yet to be drawn in the drawer. Event now will open the collision stripped and after idiotic allegiance. I'll add this. So this will check whether the position where Donna tires moving a small than zero or better than that one bit. All right. If it is, it'll mean that now, instances moving out of the room and here and I don I lied or auto bones, so just get really down. True, if the distance is going out of the room, No. One in the game and if I go to the edge of the room, you can see that I can't go out the blade just off there because the conditions great returns true. Let's move on to our next lecture. We will have lost any me. 11. D2 Skeleton Movement: Hey there in this lecture with our skeleton enemies and court their movement, the skeleton will have to Moore's off movement free movement and falling the player if the distance would. A player is loaded. The skeletons detection range during feel for the other player believed a player is nor in the range. Then it will move freely and then introductions. So no other Scott to get maker Here I word the skeleton sprites. Just like the player. There are three states Idol Move on attack. We knew important sprites. Make sure you said there, or Dental moral center and the animation speed to eight. I also have a mosque. We just like this. So first off, under objects agree a group called Enemies. And here I agree to an object called Oh, Enemies. So this will be apparent. Object for old enemies. Unlikely going. Oh, and example it. Ankle account. Obligate. I'll track down. You object on the row enemies and using F to rename it toe skeleton. So, as you can see, we duplicated when peace template to use all the court in the template for this enemy object. Now local dish and a Sinus cultures right to it now will open the window and here, drag or enemies to set this as a band of this object. Now I'll open up regiment and here I need to sort of the sprites for this Belgian. As you can see, the spite names are player for me to replace all the play attacks with skeleton. So for Darrel, press control F and this live in Tony Palm up, he ever write the text? I had to replace Sohel type player and don't click here and here. I got new text. So here are left Sheldon and then I click here. And, as you can see, all a player Text has been replaced by skeleton but also initially as a variable called range and started to 1 20 years for this little distance at with a skeleton attacks the player No, instead of the movement. So I'll open the step event and remove the more that good I'll go down on also removed this direction. Court. I removed his part because we'll be starting these variables manually, so I'll go to at all and before collisions are days. The first part is about falling the player and the second part is about moving around freely. This condition jacks were Doppler exits and districts were that these changes are player is smaller than the range. If they are true, difficult will run this. Look at the direction towards a player and this will divide the direction by 90 then apply to move. Therefore, the sprite this week at the X and Y speech towards the player using the lender functions. Basically, you can pass a speed and direction to dysfunction and fuller Don X value or by value, for you can move in that election with the speed this condition reject. Where there's an enemy, Raiders of Stone is moving. If there is it'll, said the movement speech to the role. This will make sure that enemy it'll fall into the same place when they followed a player. Now this spot with only the fourth conditions are fall, so it will. Joining the player is out of the enemy's range. The random 20 function really don't a random indeed, er from 0 to 30 and this condition checks whether it is equal to zero. So this where there's only have one ordered 20 bunch of that discord will run when this runs. The movie will be set to any random number between zero and tree since 012 and three other valid directions for it and move us and move. I will be start to move in the direction for the speed Time is in. Choose move speed comma zero fuller Randomly choose any of these values. Zero. Almost speed it. Let move or stop for the direction I multiplying. Moved here by 90 served, appear, exists and isn't well. Range the system as we move towards it while staying aware for their enemies. But the players nor encourage than 141 times this court will said the movement towards an end of protection now will open the room and in Nice France is Leo. We have so many 1,000,000 tons. Is another on the game Americans, India falling Dubelier. And if I go out the range as you can see there, stop calling me and start moving their own discernibly. Let's move on to our next lecture will make the enemy is able to attack 12. D3 Skeleton Attack: Hey there in this lecture will make the skeletons able to attack the player first will implement those cultures. Attack everything is already in place because of the his embrace views. We just have to trigger the attack. Someone discussion collides with the player. Will said the state to us to your tax so that it eggs and will implement a player not back so that no player moves away from the enemy with the impact of the attack. For their selective use boost for Ebel's so that it will be two variables both X and both. Why one for each X is these variables will be added to move ex and move. Why each step? So, as the name suggests, tell boost the movement speeds at the end of the step event. We love these variables. Zero is into scored. This is a current value. This is a target value, and this is a love value. So it will move with tax and Bush right toward zero, but reducing the difference by the 2.1 where one is accompanied difference. The higher this value, the fast rate would fall to zero. Then, when a player is hit by a skeleton. The bush where tables will be set to apply and go back to the player. No, that's got to get maker. First of all, open those collagen and go to his temperament. I scroll down and go to the attack, but here you can see your spreading for an attack. Were able to set the stage tost attack since the schools from the player, it's waiting for input. But since this is an NPC, there is no import. So remove this attack tradition and that this here So this part reject for a collision with the player and this part will check where the player state is nor the attack state. So if there's a collision with the player and the player is not attacking than the state, we decide to s t attack. So no, if you're in the game When the sculptures got close, they started liking you. Nagato appear object in the pediment Initialize boost X and boost y at zero. Now I'll go to a separate and called this part were movers and move. I are being calculated here all around. Boost ex to move X and on west wider will Boy, I am learning these values because when Wheeler pit 20 it will go through men Desmond values. But we don't want that so around it. Nor did end of this event alert days. So, as I explained earlier, the bush where neighbors were gradually move toward zero. No, it's roll up, and after the attack code allowed this the local variable enemy. We store the I D off any enemy that's colliding with the player. That's what the function is to ask. Player does its exploration with an object and determined to its i d. As you can see, I'm checking for a collision with your enemies, which is apparent. Object off all enemies. Swiffer collision is found, and that enemy state is that EC state discord. We run the variable dear. We got the direction from the enemy towards the player and boost tax and boost. Why would be set to move in that direction with eight speed? So the playable move away from the enemy? No. One in the game and when any. With the tag, you concede that a player gets knocked back by the impact in the next lecture oven, implement. Knock back in the enemies 13. D4 Skeleton Knockback: Hey there in this lecture of a little bit, not back in the skeleton, just like we did in the previous lecture will use both tax and Bush. Why? Which will be added to move ex and move I and love to zero Fuller's Begin. What's that? Open those golden and upon the argument here initialized. Boost X zero and boost by and you I'll open the step event and before the religions other this So this year around, boost X and boost why and add them to move s and move. I respectively. Now I'll go to the end of this case and before the break. Alert this if it detects a collision with a player and the player state is nasty attack, which means that it's attacking, then discovered Run the variable. There will get the direction from the player toward a skeleton and boost X and boost. Why will be set to move in the direction with their speed? So this spirit, similar to the no backcourt we use nothing object. So I hope it is cold and passed urine that extra father, a sculptor, and could be here to when you're stacking below this corner also ill states. That s t idol. So the skeleton is hit while its stacking it goes back to the Idol state? No, at the end of the step, event allowed this. So this will love these variables toward zero. So now we're looking so I can hear dining use and they got knocked back. Let's move on to our next lecture that will make the enemy is able to be killed. 14. D5 Skeleton Death: Hey there in this lecture will make the enemy's able to be killed. We learned a new state to the state seenem called dead brocade. Every able in the skeleton called HB and restore the health of the skeletal. When the players accepted this were able will be reduced by one. When did it is zero. The state will be said toe atty dead. And when the northern emission ends, dying stars will be destroyed. Let's get to gamemaker. So here, anywhere does going just right for that state. There is only one spread for the state which would be used for older directions. Measures have just be to 10 and George Integral center. So I love with no player and go to repaired event in the States. I let unedited here. So now we'll open was Garreton and go to the great event. I'll copy dis attacked but and Richard Lloyd fireplace All these attack We're dead and I replayed this bright names with escalated and dead for the spirits for the skeleton porter that stood have been tied up. So here are initialized hp at do so. This means that it will take two hits to kill this Garden. I'll go a step event and scroll down and find a dog backcourt in it. I let s p minus finals. So when the skeleton is hit by the player that people really used by one cooperatives and also a little don't look back court in that case now, at the end of this event allowed this. If that piece world in or equal to zero and the state is no doubt that state, then the state will be set to understate someone That's Ph zero. The skeleton will die. No open An emission and event are in the switch statement. I learned a case for that state and a break. And inside this, I learned instance, destroy seven. The animation put that that state and there's instruments will be destroyed later in the game. And with two hits, I can kill enemies, not a small one to the next section. 15. E1 Player Health: Hey there. In this lecture of Olympic Amanda, players held most afford initialize over Able SP at 100 in the player we need This were able to go down whenever the players hit by an enemy. So inside the skeleton, we care very able called Attack and 32 20. This means that whenever the skeleton hits a player, it's helping reduce by 20. Don't interject. Attach P A small Lenore equals zero. And if it is dusty, it could be said to her that state When the death animation ends, I'll set along 0 to 60 alarms or events that run after your side them. So in this case, the alarm zero event would around 60 Prem's after the animation ends in our game, one second study brains. So this me that land zero would turn after two seconds inside, all of your event allowed will be start, which basically restart the room and despite probably might help partner to appear on the joy layer that you earlier is. Basically, we're appears on top of everything in the game and can be used to display information like health score, elementary and so on. You can use that Giorgio event itto anything on this layer. So let's get to gamemaker. So here I am aware that that's prayed for the player just like we did in the skeleton. This one spread with views for all the directions. So I love you know, player, and go to the great event Uncle Billy attack, but and be it'd blow it. I replace all that act tax to a dead angina. Slight names with a spear dead. So despite for their death, state have been set up. No, here allow the health section and initialize SP at 100. So this will be the health of the player. Now what? I'll go to the Belgian enemy and in its created mint here initialize a variable attack at 20. No, I replied. This attacked with a player soil. Open up the object and go to a step. You went That's cool down and find an immigration court This red. A player is hit by the enemy and the knock back is applied. So here, alert this. So when the players hit by the enemy, it's as people reduced by their enemies attack nor the end of this department allowed this so that speed zero under stairs is not shared in the state would be said to be there. That state now will open the animation and event and in the switch at a case for the estate and a break as well. And its ideas allowed this a May speed will be set to zero. Stopping the animation imagined actually said to him a number minus one, which is the last frame. So the animation will be sent to a last frame and stop alarms. We always had to run out of the Supremes. Digital seconds. So alert alarm zero event from here and decided this I had grown restart So two seconds after WR dies that room very start. So now we're looking. And when the players here enough times by the enemies, it dies. And after two seconds their only starts inside a group called Gee. Why are important? Child was pride. It has two brains. The 1st 1 would be used to shoulder Ashby and the 2nd 1 rib used as a background to implement the health of our local no manager. A nobleman's great event here allowed this instead of using the actual it be for the helper , we will use this variable especial that would gradually moved words that so That's abuser dues from, say, 100 Already done will appear animator. Because of this variable dysfunction display, Sergey y Size referred the cipher the julier to the size of the camera view by default the size of a Jew earlier will be decided. The window where we won't that you earlier to appear a dusty in resolution as the game itself So values dysfunction? No. From here I let a druggie why haven't and here alert this the variable as be sure, well beloved towards a pair SP. So it gradually moved towards that be done. Espirit will cover Dove. It's to use for dialed bar but normalizing that special variable and multiplying it by the health passports wet than SB heart restored the height of the bar which will not be changed The first row spite function with the help of us pride at a four before position. Since I'm using one here, it will know the second frame which is a background, the gross right part function, Medora Dangler part or the fourth frame off the bus right dealer. The coordinates for daughter dangle starts. So it started to grow by zero and this is a size off the rectangle. So now we're in the game and here you can see the hell to bar. Now let's move on to the next lecture. We will are standing atop a object. 16. E2 Stamina: Hey there. In this lecture will and stamina to obey object, Castagna will be used when the player runs. We started recording a step, never able, said 200. The player will only be able to run if this very able is more than zero. If the player does run, the stamina were used by two, and if the stamina is lower than 100 it would be increased by two to refill it. That just like the health par in the previous lecture, Stamina Bar will be drawn in that Giorgio event or four manager. So now let's get to gamemaker. First up, I'll open up the object and go to a great event. Blow the held initialize stamina at 100 Also initials of able called Stamina Refill a Do So this will be a time of variable that will make sure that this time no, it doesn't immediately start to fill up after being used. Some people make sure that there's a really now all open of turbulent, and here you can see their own variable being set to the shift Being pressed here allowed this. Someone taking dine put for the shift key. It would make sure that the stamina is greater than zero or else it'll just region fault, so the player will only be able to run if there is stamina. No, it's cool down. And after the an immigration court before the break allowed this, this cold withdrawn. If W. Is running, some never were used by two and stamina. IFIL will be sent to 60 which means two seconds. The else part will run. If the player is not running, it will also check to make sure that the stamina is low than 100 that the stamina refill timer is zero only dentist. I'm never return. Read it by adding due to it. If the time nearly full time or is greater than zero, it will be reduced by one. So when the player on stamina refill gets set to 61 dope list offering, it gives decreasing by one until early 20 and venerate zero. The stamina gets filled up. Hear every word described for the seven. A bar just like the health power intestinal frames, one for the seven itself and one for the background soil upon all manager and open a drawer . Geo Ireland here are allowed. This just like the house, but it regards cleared the way for the time in a barber, normalizing the stamina and multiplying. Get with the sprites wit. The Y position for the Stamina Bar is foreign to do, because at the height for the margins of the health bar and the Stamina bar and the height of the bar. So it took place a seminar barbell Odile Bar No. One in the game so you can see the health part here. When I run, it starts to go down another two seconds. It starts off it up again. Now let's move on to the next lecture. Ever start working on the country? 17. E3 Data Structures: Hey there, in this lecture, I'll introduce you to Dennis Archer's in game Maker. If you already know about Infrastructures and DS lists you mesquite. This lecture in the next lectures will be making or elementary using race. And yes, layers were D s stands for their sexual. Some of you may already know batteries. Are there a collection of variables in order starting from zero toe as many elements as possible To read an animal for Maneri, you put there a name than put element number inside square brackets. DS lips are very similar. The main difference is that they're more dynamic. Dinner is for making an inventory. We needed an immigrant structure so that we can add and remove dead of in a very want. So for Dad will use DS lists. Rds list your scary during the function DS. Let's create that returns an I D for the list that you can store in a variable. Now, you can use that very able to perform any functions on the list. So using the function DS list, you can add a die inside a list to access data from memory. You use square brackets and the element number you do the same thing to exist in 11 from a list. Except you had a vertical bar before the number. This tells gamemaker that what you're trying to access is a list in ordinary No, that's moved to game. Maker of aerial demonstrate. How do Yes, let's work. So here I've cared on your project to demonstrate. How does this work? So I'll go ahead and get an object. A lot appear different in it. And here alert this. So this is great on your list in the label, my list. So there is quite simple no one artist supplement. And here are this. So if render expressed, our underworld will be chosen from these available values using the function Jews, which is random, then that really will be added to the list mile it which you created in the great event. Now, whether the drive unt and he Ellard this this court below the continental, the less the four low beside zero and end at the sight of the list. So basically the variable I will go through all the elements off the list. The local variable word. We got delivered from the list using I as a number then taught X window The word The base position to rotoworld will be four by four, but 22 will be added with my position based on the available so that it goes down with the judgment now will open the room and please object inside it. A. Now ruined the game that you can take it. The skin is empty because there is nothing inside. A less swallowed enter and random word from the tools function in the step event will be added inside the list. So now we go to a step event and here a large this the function DSS Julia deletes an element from the list. You have to specify the element number here. So if I press space than the photo, limiting the list will be needed because of specified Jiro here, which is the fortunate, my number. So now we're in the game and using enter a lot of fuel elements inside the list and no one a head space, you conceded the fourth element in the list goes away, not its move Onto the next lecture Bayville build our country 18. E4 Inventory Concept: Hey there, In this lecture, I'll explain the concept or 400 system. In the biggest lecture, I explained how DSS worked their dynamic infrastructure destroyed it out. So we make our elementary using the S list, showing each item as an element. But we will not be storing a simple value in the elements. Instead will be storing graze. So when we want to add an item in the list will actually had a smaller a consisting of two elements the first element, and are a will contain the item type. So we regarding the item types in the Needham just like the states. The second elementary contending Adam Count basically telling how much items we have of that type. So we started one. And as you get more items off that type of giving using so eat list element will contain an array with the item type and the item count 48 pick up spilling object called Oh item. It will have a variable called item type that told item type it is which will be from Dagenham. So when the player collides with this object died, um, into certain type variable will be added to the list and that instance will be destroyed so the player can collect these items and they will be added to a list in the form of binary. If the diarrhea already exists than item count in, the second element would be increased by one. This object would be dropped by enemies when they're killed. So that's a top level. Get the items. So that's got to game maker for implementing this elementary in the next lecture. 19. E5 Inventory: Hey there In this lecture of implementing country in our game, I explained the concert in the previous lecture. So now let's move to gamemaker. So here I've words bright for three items. A coin, an apple animals room. So what role? I'll open your manager and a once great event at the water. Whether this this will create ideas, let's go but be able so that it could be easily accessed by old objects. So this will be our country then the items advocated in an Inam called item The three items we create are going apple and mushroom do nothing but a big area to start us right for each item. No wonder objects again. A group called items and here are making objects called Goitom. So this will be the item that the player will be able to collect. I don't really want to you and initialized Item type admires one This way we will be given an actual value when we place an item, no open scripts and here kill a group called Items In This group will get a script called spawn item. So the skate replace an item at a position toe The American collector. So inside this great. But at this, as you can see the script X three arguments, the X and Y position Red Item will be place and the island type. These arguments will be stored in these I eba's done instance off. Why don't we be cared? A deposition set from the arguments. The I didn't I. Variable. Often musical instruments will be sent to the Adam type from The arguments done despite of their stores will be set from Dinos Friday in Norman Year. Nora create another script and cordite impose. Describe a little opposition, often item inside the inventory. And here they are this describe. It will take only one argument, which is the item diet. This loop will go through all the elements off the elementary. The variable R will get the array at inspiration in the list. The script new subject, whether they are doing type part in the argument exemption Day Elementary. So this condition reject whether the item type and Darius First Element is equal to the item type in the argument, If it is it weird, and I, which is a position off their item in the list at last. If Diane type is never found in the list. Then it buried on minus one. But if the item is found in the list, generally return its position and the skipper stop there. So now it open Goitom and out of step you went. And here large this. When the player collides with this item, the sisters will be destroyed. Then it needs to be a little elementary. So what? We got the position of the item in the list into the Adam Walsh were able this condition to explore the item. Doesn't I question the list by jacking with the Palestinians? Maya's one, because of Scripture turns minus one if the item doesn't exist. So if the condition is true and item doesn't already exist in elementary, it will be a tow. The list, as you can see, a magic an injury to the list, with the fourth element being item type and the second element of being a discount starting at one. Their spot will run if the item does exist in the list. In that case, the R variable brigadier a off the right and from the country using the island ports were able during pilot want to its second element. Just account. As you can see, I'm using an and symbol before the area element. This is called an access er. This is important whenever you're trying too hard. Anyway from a list no open or enemies. And here, under days till event and here learned this with an enemy of stars gets destroyed. It was one item at its border matched the item will be than an apple, a mushroom or a coin. So now the inventory have been set up. Don Amis job. I don't want to die and the plague and clear these items. So only to do now is draw the infantry. For this I'll open Oh manure and go to you Georgie ointment. And he realized this this local go through each element off the materialist and the r variable khodari at exposition, item and count. We could hear in type and item. Kant, respectively Distraught right function with those items right By getting it from the iTunes battery, it's explanation would be 16 and the white pushing would be 34 were 20 added to it for each element. Then the count will be drawn using door text. Its exploration will be tired too. And the high position will be the same as us. Right? And I will learn the game. And if I killed enemies, you can see that they drove items and I can collect them and they carry to the list. And if I got more items of the same type, you can see that the coded views So we have set up the basic elementary in the next lecture will make the interface for use in the items. 20. E6 Interface Drawing: Hey there. In this lecture, recreate an interface for displaying guard country. First, we get an object called Oita menu Ritual. Grow the items at the bottom of the screen. It'll have avert Ah, height. Intersil size items from the country will be drawn in the cells. Now let me explain how this interface will actually be drawn. Well, first grade us, our friends with the size of inventory window the surface is a separate space, for you can draw something and then at the end, you can draw that surface onto a screen. Think of it as a dynamics, right? You give it a size, does something to it. Then you can do it on the screen, just like us, right? So after creating the surface will fill it with a back on color. Then we looked through all the items in the elementary Andrew ourselves for each one on each sellable Jodi Arias, Sprite and the item count then will grow the complete surface or to a screen where the object is located. So now let's open gamemaker. What's 400 objects? Let a group called the way and here make an object called or the menu a lot of creative int and in a dollar this first these were Abel's weaken, diverts and Hide of the Jew. Earlier, Susan Men Tree will be during the joy earlier we need to start its size going toe. That distance had the size of the square, so to try to buy two disinterred over 10 height of documentary menu, the virtual 80% of that you ever it and the height really equal to doesn't size. Then the explanation would be said so that its donor that center. So from half of the Julia's wit. Half of this manuals, which were disaffected the Y position will be said so the destroyer the bottom. So from the joyless height, the menus height will be subtracted. Nobody to draw the inventory but before doing that will set a color for the background. So I click here to a believer able definitions window. Here you can initialize any variable so American air to whatever able and in the name dieback color from this drop down menu as like color. And from here it's like the color for the background for the interface. No again closes and no one of the drawers. You Why haven't. And here like this. A surface cold surf will be created with the size of the menu, Then using surface at target that your target will be set to that surface so we'll be able to draw on the surface instead of drawing in the room. The function draw clear fills the screen with a color. Since we have set a target to a surface, that surface will be filled with the background color. No other. This this is the border. There will be only itself. So there will be a two Bixel border. Then this look. We go through the element in Denver. Entry are bigger, Deirdre and Item and Count. We could be Adam type. And yet, and going from the array, the variable X X is the integration of the cell. It is I times. A cell size discord will grow direct angle of the cell. You can see that I'm setting the alpha or a pastie to 0.2 and deciding it to one after drawing, enjoying the rectangle at the service position using the cell size. I am also taking the border into account When trying rectangle, I'm adding a border to rectangle location and subtracting two borders from the size. You notice that I'm just shooting cell position, quarterback success and for the by and not even a leading opposition. This is because the surface L separate space, it's not a good inside the room. Then I'm drawing this right, taken from the rain or manager using the item type. It is being drawn or the center of the cell riding half its size to the position. Then the count is being drawn out. The self television and now alert this for us. It really certainly door target. You should do this after trying to any surface to tell gamemaker that you are done trying to it down. It will go. The surface at National says position on at large. It'll Frida surface, moving it from the memory. Now open your manager and at the end of the government allowed this. So disagree identifies objects agita by zero because operation would be set in that objects created meant so disposition doesn't matter. I also open a Georgie Wayment and removed a code that draws inventory. We don't need this anymore, and now we're looking, and if I collect items, you can see they show up in nine defense below. Now let's move to the next lecture. Very well made items able to Beale's. 21. E7 Item Selection: Hey there in this lecture removed items able to be used first. Look at the position of the mouse Will check if it is inside the inventory menu. If it is well divided, some want opposition by the same size and stored in a very able called em sell. This will be the item number the Mosses on if the user presses the left. Most button. If we could item in the list using em, sell their don't add item. It will perform an action, for example, and a purpose. The health and a mushroom gives terminal. Dendy item can be reduced by one. If the concrete zero, then that item will be removed from the list. Denver Make it so that you could scrolled inventor using the most weed, so they were able scroll with initial idea. Zero. It will be increased or decreased based on the most well, this variable will be subtracted from the salad positions to draw them correctly, and it will be added with the most position to make up for the contraction in doctoring position. So now there's got to game maker. I'll open Oita Menu and go to the government. Here are initialized himself at my salon. And now let the supplement and he alert this and next time I will get the Moses position will not go earlier. The variables most except most Wyke and operation of the most inside the room. So we had to use these functions to get the most position on the G while ear then m in reject whether the most is inside them and you by checking where the most point comes inside. Demon you rectangle. If the mouse is inside, the menu themselves be set to this value here. MX minus excellent subtracted menus exploration from the motors expedition to get the relative most position and divide by the cell size to get the iron number. I'm using the Devo operator because it also floors the results. But if the mouse's nor inside the menu that I'm sure will be said two miles, one and now alert this year doesn't make sure that M Cell isn't a Lestrange. My making show that's at or above zero, and that's blown a list size. It will also check whether the left most water is breast every day. Is Eric Addario diet amusing himself? Then this were able to get the item type a local very able called successful. Beside to True. This will tell whether the item was a successful, used or not based on the Adam type. Different cold We run industry statement. If the item selected is a napper, the players health will increase by 15 every so much room. The stamina will be increased by 50 for a coin. There's currently no use soil not be able to use it. So if a coin is selected, the successfully able will be set to falls. But if the item was successfully used, it's going to be decreased by one in the array. And if the counter zero that entry will be removed from the country, list No. One because more general drawing court soil open a Giorgio event. And here were doll fights at 20 going to alert this. This is a condition that's expected to sell. The most zone is equal to I, which is a sell. This loop is on foot. Will check whether the Moses on this item. If it is alert on one if not elegant zero, it would be multiplied with little went to serve. The mouse's on an item itself or will increase when you went to an hour in the game and collect, um, items. If I click on an apple. My health in greed is, is if I use a mushroom, Masterman increases and the coins can be used at all. Now let's implement the scrolling. I'll open the merriment. And if life scrolled are zero now I look in the step we went under the end other this despite with it on one. If the most really scroll down and my last one ever just rolled up that value will be multiplied by 16 and added to scroll. This part will make sure that scroll doesn't go below zero by choosing the value that's larger from zero and scroll. So in case called Goes below zero, it recited to zero. Now we'll go to this part and at school. And now look when Georgie weigh and subtract scroll from the cell position. And now we're in the game and using the most well, I can scroll down men tree. Let's move on to the next lecture related item effects 22. E8 Item Effects: Hey there. In this lecture of implement the item animations first will implement the entry animation where the item scale up for Dad will set its horizontal and vertical scale 20 indicate event during the step event We love the scale to one. So disseminate the item grow Next will implement an exit Animation read item afraid away This will take place when the player collects the item we could ever able called collected and sell it to falls This will tell over the player has collected an item or not went a player touches it will start collect little drew if collected is true image Alpharma produce positive 0.1 And why we produced by one sort will fade away and at the same time keep moving upwards When did Nigel forage Zero down and stuff will be destroyed So no, there's got to game maker. I'll open Oh item and go to a government hair alert This this will initialize collector It falls and this one had the scale to zero. So I open a step imminent and returned under this. This would love the horizontal scared towards one and this will start the vertical scale to be the same as a hotel scale. Now we go to despite with a player, gambler, the item and here alert this So this court will only run when the player hasn't collected this item. Now I remove this instant destroy function and here said collected to drew someone to play a collection item. The collective variable will be set to true. Now, at the end of this event on this one, the player has collected the item. The Alpha produce positive 10.1 and the item will move up by one each step. Wendy, all forage zero diet does will be destroyed. So now we're in the game and get some enemies. You can see they're going and emission when the items appear. And when I collect them, the fate of and move up No, that's move onto the next lecture. 23. F1 NPC Movement: Hey there in this election, result of our first NPC robe. Remember, we had an NPC template will duplicate that a name it or job for a person PC. That object would have okayed event and a step event from the template. When we want to create different NBC's will duplicate this one and change their names and sprites in the treatment. The step events would have the Movement and Attraction court. We will need a way to connect the separate events off all day, listing NBC's so that if you make a change in robes, step, prevent it effects then as well. So you create a script called NGC Step will put all of the step event called into the script and quality enrolled in PCU step events. So this way, all of NBC's will be learning the same court, which will be in the script. Denville implement random movements in the script so that the NBC's move around. So now let's get to gamemaker here everywhere. Despite for the NPC under a group called Robe under Delicacy Group, it also must right, so I'll go to the objects and get a group called NPC heartily content. BC template and select obligate. I moved on your object under the embassy grow now Arjun. Its name to Orel. I love when it and yet despite as well, no opener spanned window and click here to separate spare toe or collision. This will make sure that a player can't go through this NBC, so it'll act like a solid object. No open to create event here, are removed the attack part for the supply. It's because the NBC doesn't need it. X prides. I lied, Control left and replace the player. Text with robe, so that reduces the CORRECTS rights. Here are English Last Max dish At 64 this will be the maximum distance it can go from the point of prosperity. Now we'll go to script and get a group called NBC. Hail Good, that's critical. And Peter Step now Logano Robe and go to its separate meant I had control A to select all the gold and her control. Extra Card it. Now we'll go to a script, and he controlled me to paste. I'll go back to the step and called NTPC Step Script here now will open the staff script and remove this part with the movements and move. Why are set will set them manually. Solar. This here discord has only a one out of 21 John's off running. So that's one. Then busy. Virginia's movement there will get her end of value from 0 to 60. It'll be the direction and we see we move in. SPD will choose either more Speedo zero shortly there. Move or not move, move, effort, move. I will be there to go into the SPD and their values so they read. Moves nobody to stop then PC in two cases. One, when there's a player of it is going. And second when it's going too far from a starting point. So here alert. This just triggered the distance from the NBC starting point stored in the X started Vice Outward labels to the point where it is moving. Dis condition. Which equity? There's a player, but NBC is moving over there. Distance to the starting point is greater than Mac stressed, which we settle 54 in the create event. If these conditions are true, move s and move. I will be set to zero so that the empathy stops now will open the room and there's a robe. Object here an hour in the game and you can see the NPC here. It moves in random directions. Notice Move onto the next lecture. Very child working on the dialogue system. 24. F2 9Slice: Hey there in this lecture will get online. Slice script Nice less scaling is used to scare squares price properly. Let's take this Sprite, for example. If I skated normally, scale like this, every part of the Sprite would be scared equally. But if I scared it using nine slice, it'll scale like this. You can see that the corners have nor scared and overall image looks Lord better. Dead silence lights, works. The corners are north scaled and only the edges Anderson to partner scaled. This basically don't by dividing us supplied into nine cells, hence nice lives and drawing them separately. So using this technique, we can draw it. Exports is so let's get to it. So forth to fall, I'll make a script and Nimet drawer line slice inside the scrape. Tyler, this so here. I'm starting of the arguments. The arguments are the X and Y position with us. White will be drawn never tonight, despite and the sub image. And here I am storing all of those arguments into variables and no other. This disregard the size off, one said, by dividing the spread rate by tree this week at the weight of the main part, which is the salario in the center, so it will take the average from the arguments and subject to sense from it. This will do the same for the height, then this part. Look at the scale of these variables as compared to the cell size using division nobody to draw the corner solar. This draw despite parties, a function that draws on rectangular part of a sprite. This is a sprite, and this is a sub image. This is what defines a rectangular part of this plight that's drawn. So this is a position of better tangle and decided size. First, I retrying the top left cell, so that entangles position would be zero. By zero. The size will be the cell size, which would be the same for every cell. This is a position where it'll be drone, so the Tobler cell will be Joan in a position passed through the arguments. This will draw the top right sell. It was a little position in the supply. It comes off the two cells. It would be donor disposition. The X is calculated by adding the average to the position and subtracting the cell size from it. This will draw the bottom. Let's sell its vertical position in the supply. It comes after two cells. It's why is calculated by adding the high to deposition and subtracting the selfies from it , combining the values you to not operate part and a bottom left part. The border right part will be drawn now will draw the raft of the cell. So I let this this will Georgia's 100 baht. You can see that I'm using that draw Sprite party X T function instead of the normal because this one has killing so I can scale these cells Disregard inspiration from the right and this will droid biting the sensei sweats invite. It's kale will be these labels, which look at Gillard here. This is the color value. Minus one means that there's no change and this is the alpha value. This was or not Upsell. You can see that it's X scale is set to that very able, but the wire scale is one because it only needs to scale horizontally. This will do the same for the bottom cell. Then the left cell would be drawn. Its X scale will be one, but it's wide scale will be set. This would be because it only needs to scale vertically, and this will do the same quarter right cell. So this waited over the corners down the center part and then the edges. So the nine slash script has been set up. Is India's will make art exports in the next lecture? 25. F3 Textbox: Hey there in this luxury will set about export script. We get a script called Wrote Exports, Duguid or not, exports on top of an object. It will take two arguments, a string and in amount of characters. The string would be that extra will be drawn, and the characters will be the number of letters that it will be drawn from the string. So if I passed a string here and in the characters, I type two dental only draw two characters at Andy. This will be used for the typing animation. The textbooks itself could be Joan using the nine slash technique, and a smaller will be joined at the bottom of that X walks solar. Start implementing it. Another Jew Y folder. I've imported two sprites. This is our textbooks, which is Doctor Square. And this is the arrows, right? Make sure its origin is top center. So we'll go to a scrapes and enter NPC. Get a new one called or text books inside descript alert. This You know, I'm starting of the two arguments string and characters and storing them in local variables . No wonder this the function string cooperators a part of a strain this adjusting to use this is operation from very dusting will be caught and this is the number of characters to take from that place. So from the starting off the string, it will take this amount of characters, which is from the arguments it was told, a result in this label this is the maximum rate of the text. If a lion goes beyond this weird, little be moved to the next line. This were able to get the metal door. It'll string. Since I'm using the extreme unction, it'll only be up to demand some wet. This is the distance between East line and I'm starting to minus one so that it uses the default value. So these very buzz liquor, David and the height of the little string and no other. This these were able speaker the pollution where the Arab will be Joan, which will be used as a base for that ex walls. So the Arrow X is I Stances X and the area. Why is our chances why but half of the sprite height and it is subtracted from it so that it appears on the top. This is the margin that will be our between the text and the text. Water's edge. These were able Spilker, Davitt and height of the textbooks by adding to margins to dusting size. These very bus look at the position of that expose. The X will be calculated by subtracting half the text boxes were it from the Arrows position and the why will be calculated by subtracting that exporters height from Darryl's . Why no other positions and the sizes have been set up. So we'll go that exports. This will draw the arrow supplied at disposition disorder attacks works right. Using Good Night's Last Craved it leaves out exports is X vivat and height variables recited before this part. With all that extra, you can see there answering the color to black before drawing so that that extra was black and you're setting it to white. After drawing, the text will be drawn, not export disposition. River the margins. I do it. I'm using the e x t function. What? I'm excellent right argument So it will move their tax to on you line when it reaches this wet. So now the script has been done. I'll pass it on the player for now. Soil open the play object and added or event here alert is This will make sure that the player is drawn and this will draw it exports with this text. Since I wanted four here, only four characters from the strings or draw soared on the game, and you can see that exports on the player. You can see that only four characters are appearing, so I'll go back to the play object and leave the droid mint. Since it was only for testing. Let's move on to the next lecture, be able implement a Dallas system and then BC. 26. F4 NPC Dialogue: here, there. In this luxury of a start up our NBC dialogue, the NPC will have an array court message. Diver contained the lines offered style all day will be to wear Ables line and Shar like maybe used to show the line we are own and will be used to guard from there a sharp restore . How many characters are to be drawn from the line for driving animation? I would also make other able called talking. Tell the story better than PC is talking or not in the step imminent reject with their distant stood. A player is small enough if it is then talking with me said too true and the dialogue will be displayed. When the player presses enter, it should move to the next line in the drawer. Event will rot Expo. Excusing that draught export script we made in the previous lecture, soldiers opened up gamemaker. I'll open Orel and go to the great event here. Alert this de that alliance for this NBC And here are initializing char and line at zero, and talking at faults now will open the embassy staff script and go to its end before this write code under this discordant run. If the distance to the player is world and for in that case, talking will be set to true discordant, then PC phase the player. It'll take that direction towards a player divided by 90 using Dave 100 floors and apply it to move dear. This very able will get the length of the grand line, basically the number of characters that are inside it. This will get the total number off lions in the air A by getting the areas lend. If the amount of characters in Dutch are variable, is smaller than the total characters, then the Charmery, but will be increased by one. So each tablet will keep increasing the number of characters that are visible. And when the char variable reaches a total length of the string, this will become falls, and the else part will activate. In that case, if enter expressed, and if the current line is nor the last line than the line, we've increased by one and Charlotte were you set to zero. So if this condition is true and a player is near the NPC, it'll talk. But if it's not near than discordant run, which will reset line and shot 20 and said, Talking to Falls No. One in to disable the NBC's movement. What it's talking so that it doesn't move a so I scroll up and go to this. But here at the end of these conditions, I let this. So if the NPC is talking, it will stop moving. No, we need to do that exports. But before doing that, I'll go to the phones. Unclear. A new one I limit After dialogue. Here, you concert a custom phone for the dialogue and give it a size. So now we'll go to the scrapes. And under NBC killed a new one court and PC troll. This will be used in a draw event off the NBC's inside it and that this this will draw the embassy itself here. If then PC is talking battles on the phone to after dialogue. The one videos created on Draw that exports the stringer to pass will be taken from the message using the line variable and sharp abused for the number of factors now will open Orel and here at a drive went inside this event. Alcohol, DNC, draw script. Now we're in the game. If I go near the NBC, you can see that it is talking. When I go near it, it faces towards the player and stops moving. And if I hit enter, I can move to the next line. Now let's move on to the next lecture. 27. F5 GUI: Hey, there in this lecture will make the textbooks appear on that you earlier little. Make sure that our textbooks always appears on top of everything else. So first I'll open the door textbook scraped. Here, you can see that the textbooks is using the senses coordinates to draw correctly under joy layer. We will need to subtract the camera's position from these coordinates. So here let this dysfunctions. We got the accent by pollution off the camera, which will be done subtracted from Darrow's coordinates. We need to do this to convert the room coordinates into coordinates for the Joy Lair. We no need to change the script from drawing to Georgie. Why? So I'll go to the scrapes and click on Democracy does great. I'll hit F two and rename it into NPC drug ey. I'll open the script and removed yourself because a player doesn't have to be drawn into Giorgio. Event now will open or or when I click on the drive event, select your enjoyment and 200 into dodgy y. Inside this event, I'll call the right script and beauty. Georgie. Why so no other textbooks were correctly appear on the julier. If you don't use a Jew earlier than things that are lower in depth. Then the NBC, with appear on Tober got exports, and that's a problem. So I told, it's good to have your text boxes on a year earlier. So now let's continue to the next lecture. 28. G1 Houses: here, there in this lecture of relied houses in our game here underworld. I've created a folder for houses and imported those brides. Quarter fall. Make sure that their origins are middle center and dance out of the mosque. So I'll go here and under more like manual. Now it's hard. A collision mass for the house. I do the same for the second house. Bright. Now we'll go to objects and in the world appeared a group called Houses. Here. I'll make two objects or how side and Ohio Front I have had displayed for both of these objects. Now we'll go to the parent section off the first object and select or collision at experience. So this way the houses will become collectable. I'll do the same for the second Hours, now will open the room and plays the houses in nations is layer. I run the game. No, you can see the houses here, and a player is able to collide with them. Let's move on to the next lecture. Rebel outdoors 29. G2 Doors: Hey there in this lecture with our doors in our game. First, we'll create rooms for the houses that the doors will lead to. So I'll first get a room called arm. How zero. Which would be the room for our for our house inside it replace the player and an excellent object that will enable a player to go back outside. Then we created or object. It will have a very able called target room that will store the room it leads to. When the player touches this door. It's animation will play, and when that animation is over, it looked a player to the target room. Then we make the main room persistent, and the old manager and oita many objects as well. So if a room is persistent, it means that when you leave it and come back, it will be in the same condition as it was when you left it. And if an object is persistent, it means that when you change the room, the persistent object will come along into the new room as well. For this way or manager and Oita menu will stay there no matter the room you're in. Fuller's got to game maker here. I reported this bride for the door. Make sure its speed is age and origins Metal center. We need to extend its mosque. For that, it's easy to go into the door. So open the mosque menu. Here's like manual an extender tangle from below. Here I am what it has bright for the exit object that would be in the house rooms. It'll be invisible. So that's pride. Doesn't matter that much now. We'll go to objects and open world under houses are you create or door Denel create or exit . I'll go to rooms and create a group courthouses. Under this group, I'll get a new room called Arm. How? Zero. I'll go to the room settings and started size 2226 by two of his aides. Inside this room, I'll place the player, object and exit object now will open the door object. A click on the variable definitions window, and here are the new were able called Target Room afflicted Stipe, as a resource with North at its value here, will do that would replace it in the room later. So no wonder the creative mint and hear other this the variable toast with durable Player has touched the door. Disincentive made speed to zero so that the door opening animation doesn't play from the start. No wonder the step event and here alert this extra s regard. Absolute distress between the players X and the doors adds. This will be used to make sure that a player is roughly aligned with the door before entering. So if the player has entered the door, the player is colliding with the door and the X distance is moral entry than this court will run. It was that close to true. It'll create a very able called player why they restore the Y position of the player so that it can be restored when the player comes back. This will start MSP to one so that animation starts playing No. One or die New mission don't event. And here are this. If then emission ends and Dutch is true. Then we go to the drug that room, then the players why we decide to the variable player why Britain will also be moved down by its more speed so that it doesn't collide with the door again. Then the door state will reset 33. Besides your falls in a speed, we decide to zero so there'd animation stops and a 1,000,000. That's where able because had to zero so that it goes back to the first frame. Now we'll open a player, object and go to a step event a school down and before this bright code alert days, disregard the idea of the door that's gliding with a player. If the door is found and if that door study variable is true, then the play will be moved of. But I do think it's like instead with has had to move and move everybody to one so that it moves up. Now open the room and go to this house. I'll place a door here. You can hold the control key to place it freely without snapping to the great. Now we'll double click on the subject and click on variables. I did the target rumor able and select the room arm house You. I'll also change this room's name to RM. World using of to now will open the exit objects. I'll make it invisible by disabling divisible checkbooks under the SEPA Village. And here are this when the player touches this object. It'll be taken back to the region Room now will open the room and go to the room settings here Arctic persistent now will open Oh manger and do the same. Now will do the same for Oita menu an hour in the game. If I entered the door, it goes to the room. I can also come back out now that won't toe the next lecture. We will fix some issues. 30. G3 Camera: Hey there in this lecture will fix the camera and at times in the houses. When you enter a house, you notice are w a stretch. So to fix it, Aleppo, no manager. You see that the camera court isn't up yet? Event So, first of all, I love the room start event now will open the creative end and select the camera court along with the gold. For that, I'll set I recorded and placed it in the room start event. Previously, the camera would only be niece lies in. The creative meant when the game started and dominated was created. But now the camera will be in east lies each time a new room starts and the variable global times walls will also get a new Tom Obaidi whenever our new room starts. No, If I run the game and enter a house, you'll notice that the camera is no longer stretch. Let's turn the camera is north centered, so I'll go here where the camera is set up and instead of four player, I'll put my swan previously put O player here because we wanted the camera to automatically followed a player. But now we will manually handle the camera following, so I'll start this to minus one Now will open the end step event and hear about this. These variables we could've it and height off the camera. Many want to center the camera on a point you subtract half the cameras, wait and hide from that point position. So that's what I'll do with the player. I'll subtract half the camera size from the players position and set them to these labels. This will clamp or limit the camera position so that it doesn't go out of the room. This will be the lower limit, and this will be the upper limit. The lower limit will be zero and the higher limit. Rebuild a camera science of track it from the room size. Now this is the court four small rooms like the one for the houses. So in case the rooms were it or hide a small and the cameras were to write, the camera will focus on the point that is in the center of the room. We'll get this point by dividing the room size by two, then using dysfunction. The operation of the camera will be said to these values now we're in the game and the camera is center in the house. But you can't really see anything because the room is empty, so I let tiles in the house. Rooms here have important that I've sets right now. We'll go to dial shirts and our click on a background tiles that I'll duplicated and name it Tea House A change its rights to the House style set. So this way we didn't have to start the order dialing tablet again. Now will open the house room. I go to the layers and create a new Tyler Cold tiles house on the right panel as like the house that I said we just created. Using the order toiling tool, I will play as a dies. Now we're in the game and enter our house. You can see that it looks a lot better now. Making the room persistent has resulted in a small book. If you let a player die, you'll notice Daddy doesn't respond. Since the room is persistent now, pretty starting here doesn't reset it, so I'll open oh player on open its alarm. Zero event here, I'll change room. We start to game restart. So instead of restarting the room. It'll just restart the game. Now let's move on to the next lecture of able, implement and very saving. 31. G4 Saving: Hey there in this lecture available man, Temporary saving when you go from the whole world into a house, you lord, is that the health and some 94 or no transferred And there, he said, that happens because the pay object, unlike domain, your object is created again inside the room, so dialed and the stamina values are, he said. So we had to temporarily save the players in for further. We can load it back when we go into the house for this will need to use a knife files, and I and I file is attacks foil. You can save data from your game so very loose on their files to save the players health and stamina to be loaded when we go into a new room. So when the player leaves the room will save its HP and stamina into a nine I file called tempter I and I. When a new room starts, it will Lord HP and stamina from the line, I find if the player closes the game, though, we don't want them to be able to restore dine for when they open it again, because this is not a proper save system So when the game ends quickly design. I file. No, there's got to game. Mickler four Star open a play object And here at a room and event, this is where we'll save dine for So alert this the function I and I open opens an iron I file using a name. If data and I file doesn't exist, then it will be created after opening and and I file you can write it down into it or read it up. So I'll say that speed and stamina variables the function iron I write really right cereal value into the and I file A really is a number. The text counterpart off dysfunction is iron. I write string which saves a string value into the and I file. This one will only say the number since the SP and seminar our numbers, we will use dysfunction. This is the section where that really will be saved. This is the name or key off that value. And this is the value to say for the HP and stamina. Values will be saved in I and II files. Then I and my clothes were closer and I file and save it now all of the rooms Argument And he alert this dysfunction Protect What did that em toda in a file exists. If it does that I and I file will be opened. The function on I read really will read our real value $7 I file here I'm reading the SP Value saved in that file I am using the section and a key I used when I saved SP value. This is the default value that will be returned in case this key is not phone to know and I file So it will read that being seven, a values from the and I file and apply those values to There were Abel's. Then the and I file will be closed and then the files will be deleted because we will not be needing it again. Nobody could lead the file in case the game is called Soil Open or manager and add a game and event Distance vendor games Schoolers, He alert this. So when the game ends and the attempted and I file exits, it will be really did. Now we're in the game. No, If I goto adore you see that the health and stamina stays the same and doesn't get reset. So let's move on to the next lecture 32. H1 Blend Modes: Hey there. In this lecture, I'll be explaining what bland moors are. Blend morts basically give you the ability to change how you draw something. Whenever you draw something CS bright, it draws up excess onto the main surface. Now, for each pixel, there are two components. They're the source pixel, and the destination picture. The source pixel is the pixel that you are drawing. And the destination pixel is the pixel that's already there, where the new pixel is going to be drawn. So using a certain formula, the source and destination pictures are blended together to calculate the final pixel, which is the output. This is that formula. Here is a source pictures color. Here is our destination pixels color. And both of these colors are being multiplied by a factor. Values Dad, determine how they are drawn. Then they are added together for the output. Both pixels contained for components red, green and blue which make up the color and the other fellow that pixel Normally the source pixel is multiplied by the source alpha, and the destination pixel is multiplied by the inverse off the sources. Alpha Dean worse is calculated by subtracting the al far from one. So if the source all for is one, that destination color will be multiplied by 04 completely disappears. But if the social for is 0.7 dunder destination color will be multiplied by 0.3. So this way, when both of these colors are added together, there are farms will become one. You should also know that since the colors have four components, this is how the multiplication will actually take place. All four components will be multiplied by the factor. This is where blend Moore's come in. Using land. Moore's You can change the factors that the source and destination pixels are multiplied weighed the function. Jeep, You said blend mode can be used to set up land more from the vans gamemaker provides. But if you want to set the source and destination factors yourself, you can use the function Jeep, you said blend more txt, which allows you to set both of them separately. You concert the factors using the Glenmore constants Gamemaker provides. Some examples are being zero, which multiplies a color but zero B M one, which multiplies it with one being source. Alpha, Multiplying it with the sources. Alfa and B M in Warsaw Sulphur, which is are involved for those horses. Alfa. So there are many more blend more constants that you can use here. I've created a new projects for testing Glenn Moore's and imported these two sprites. Sorry, create an object and two, it assigned a forest sprite. I look in the room and plays. The object here now will open the object and at outdoor event insiders, events allowed this. This will draw the object itself, and this will draw the second Sprite. At the more escalation that's pride would be drawn using a blend more. This will start that blood more. The source. Big salt will be multiplied by one using BM one sort villa disappear under destination pixel will be multiplied by zero using BM zero. So we're not to be at all discovery set up, then more to the normal blend mode. You should always do this after you're done using Gordon Moore's So now we're in the game and you can see that the sprites are drawn. One is the object, and the other is Jonah the most position. When I moved the Sprite over the objects, you'll notice that the empty space in the sprite is appearing Black Sea. That happens because of you zero for the destination pixel. So no matter what the source is, no destination will ever appear. So that is why everything under described disappears. Now we'll go back to the gold and genius part. The source pixel will be multiplied by 04 to disappear, and the destination pixel would be multiplied. But our sources color like this. Now we're in the game and hold the most over the objects you can see. There. The colors are being multiplied. Now, if you want to know more about the blood more, there are you can middle click own dysfunction name and the maneuverable open. Here you can see the different kinds of land Moore's there are. Let's move on to the next lecture where we make our day night cycle. 33. H2 Cycle Concept: Hey there. In this lecture, I'll explain the concept or for the inner cycle will create a very able for storing the time called global Time. It'll go from 0 to 23 generally just 24. It'll go back to zero gain. This world will keep looping. No, we're advocating two faces off the day, evening and night for the evening day. Variables will be evening color evening, time and evening Spread evening. Call level with a tent off the evening, which will be an orange evening time. Repeat a central time for the evening vigil between Devono cloak, which is nine PM evening. Spread will be home where the evening effects will be spread out. So if we said this to three, then the evening will start three years before the evening time, which is 21 end after three yards for the night. Variables would be night color. Nighttime a night time. Be a nice spread night, Columba. Be that end for the night which will be a dark blue for the time. This will have two variables instead of one. There'll be nighttime air. Nighttime be the 1st 1 is when the night will start, and the 2nd 1 is when it land and night spread would be home for the night. Effect it spread out will create a surface for the day night cycle that will contain the color for the time. So we'll Georgia evening color and night color or to the surface. So when this evening the color will be orange where it is night, the color very dark blue. On that day, it would be white. The offer of the colors will be get alerted using nor distance to dead colors time. Then, this surface will be drawn on the screen and using a blend mode, it should be multiplied with the game surface. For the final effect, let's move on to the next lecture. We will start implementing our dinner cycle. 34. H3 Difference: Hey, there in this lecture will create a different script. As you know our time. Very able to go from 0 to 23 military just 24. It'll go back to zero. So what if you want to get the difference between two times? The difference is calculated by subtracting those two values and getting their absolute posted value using a B s. So we have won the difference between five and seven. I'll do a Bs seven miles five and get to. But what if I want the difference between 40 and one? As you know on the cloak, 33 is 11 until the difference between 11 and one should be two wars but refuses formula. Then, by doing a B s 23 miles, one will get only do. That's a big difference and not correct. So we really to make a difference script to calculate the actual difference between two times soldiers opened up gamemaker. Okay, does scraped and neighbor difference in the script other days descript reject three arguments? The 1st 2 arguments are the numbers for which we want to calculate the difference, and that heard argument is a limit of the range, which in our case is 24. So the arguments will be story into these variables disagreeable, bigger, the normal difference between the two numbers by subtracting them and getting their absolute value. This part regular the second difference value by either subtracting or adding the limits to the first number. If it is greater than B, then every decreased by the limit. But if it's more will then be dental, be increased by the limit. Done this for able Look at the new difference between the new A and B So this works like this. So you warn the difference between 23 1 and you use the function like this. The 1st 2 arguments are the numbers for which we want to calculate the difference. The last argument is 24 as it is a limit off. Arrange. Now look at the code here. Sincerity is greater than one. It'll be reduced by the limit, which is 24 so it will become minus one. So if you get the difference between minus one and one, you get to which is the correct difference. So this look at the minimum value from these to the wonder the smaller and return it so the script will return this water difference. Now let's move on to the next lecture we will set apart in our cycle. 35. H4 DayNight: Hey there in this lecture will implement already in our cycle. First I'll open or manager and go towards create event. Hey, alert this. This is the time, variable. I'm selling it to nine foot Will started nine oclock This very able was told a surface that would be used for the lighting. I'm initializing it at minus one because I'll create the surface in that draw Big in imminent and not here. This is a time of diving. This is a time when the night starts and this is when you don't did that. The spread values off evening and night. With three homers you spread out. Now we'll set up the colors for the lighting alone. A variable definitions window on add one our limit Evening color. Under this list, I'll slide color. I click here to choose a color and make it orange. I learned another one. A name it night color a set color from here and choose a dog blue color. Naturally increase the alpha from here. When you make a color. No, I closes now will open the room start event and here you can see the vert Heightened scale variables which are local variables. We need to make them in terms for Ebel's so that they can be accessed in other events so removed of our from here and remove the commas as well honored semi colons in their places . So this is what it should look like. Now I'll open the step event and at this discipline, increase the time very able. But you don't mind one each step. As you know our time very able ranges from 0 to 24 so we should not let it become 24. 25. It should be set back to zero when it reaches 24. So this is where dis treatment will do. Using more that I'm very able will stay under 24 someone to do just 24. It will go back to zero. No internal Drogin event here. Lard is if the lighting surface doesn't exist, it will be good. It it's isil with Roberts and height of the camera. So this looking at the surface in the beginning and we'll also created in case it is destroyed because surfaces can get distorted a medically you have to recreate them if they don't exist Now we'll go to the drug ey haven't and added So pilot this. We'll draw the lighting here so it will start that George Argus to the lighting surface. This will fill the surface with the white color. Here will draw diving color so evening. Just look at the difference between the current time and by evening time using our different script evening, all for bigger the all for David in color. First of all, it will subtract the evening that's variable from the evening spread. Very able decision because Alfa needs to be inversely proportional to the distance. So if the distance is full according to a spread value, the alpha will be zero, but the distance is zero, then the alphabet before if the distance is out of the spreads range than discolored on a negative number. So in that case, this max function will slash zero so that it doesn't get donor negative number. It distorts a dear oh. Then the result will be divided by the evening spread value to be normalized to a 0 to 1 range. So the spread is three and the oil for three as well. It will become one, then the color will be set today evening color and the alpha will be said to Dave Mingle far rectangle will be drawn with the side of the camera, then the color and Alfa Mulberry said 2 34 values. So this winter evening, Godfather be calculated and it will be drawn to the surface. Now allowed this he ever draw the night color display create ever able for tonight. Alfa. If the time is in the night time range, doll for will just be one. But if it's out of the range, the night also will be calculated the same basic irregular diving all far since there are two night times that distances to both of the times, we calculated like stay and I just be. Then the night this very able very good time minimum off. Those took out the distance that the smaller than the alpha will be calculated. A normalized dinner rectangle with the night color and alpha will be drawn, then dysfunction where you said the drawer target because we're done drawing toe the surface. No alert this. If the room is RM world, it will set the blend more to multiply the source and destination colors and draw the light surface Dennett release heard a blend more. We're using this condition to make sure that the lighting doesn't affect the house rooms and only affects lower world dysfunction. With ordered I'm value, you can see that I'm using a string function around the time very able took on board the number into a string so that it can be added to the string. Now we're in the game here. You can see the time the evening is a bold and orange color on the night makes it dark blue . I'll open the step event. We have added to the 0.1 here for testing, but this is too far, so you can replace this value with something lower. Like we don't 0.12 so that I'm down. Let's move to the next lecture of every led lights. 36. H5 Lights: Hey there in this lecture will add lights in our game will create an object for the light and place. It's in chances in the room. As you know, we have a surface that draws a day color so it draws white for the day or for the evening and dark blue for the night. On that surface, each light and starts withdrawal white circle. So that way the area in that struggle will appear completely late. So no, there's got to game maker. I've imported a large spite here on the world. Open it and make sure that its origin is Our separation from very light is coming. So I said, my origin to this point, I'll go to objects. Underworld will create an object called or light. I'll assigned the lights right to it in its creative mint allowed this. This is a radios for the circle. There, the large withdrawal. No, we don't handle that doing here. We're in the old manager Object soil. Open it and go to its Giorgio event. I'll go to the part before surface Reza target to draw the circles while the surface is active. After the time colors have been drawn solar. This here this was at a blend more to the advent, more orderly, given and gamemaker. This basically adds the colors onto one another instead of replacing the destination color . This is used because a circle that will be trolling will be a vital black circle. So if two circles overlapped, it would look like this. But if you do it using the Advent board, then only the white parts would be drawn nor the black ones, so it would look like there's so nobody or the circles using with you can run some good. In any instance, since I using or light here, the court and this block will run for all the entrances off a light present in the room. Drawbacks and job. I will get the pollution of the light on the julier by subtracting the camera position from the light exploration. Then this withdrawal. Asarco. This will be exploration. This will be Australia's, which is a very able in the late object. This will be the color in the center, which is white, and this will be the color at the end of the circle, which is black, so it'll go from white to black But because of the advent mode or in the white pixels will appear. This is, you know, to make the circle fails. If you murdered one, it would only draw the outline. This will reset the blend more to the normal. Ben More no will open the room and players the light instances under in the game That evening, at night you can see the effect of the lights. Let's move on to the next lecture. Very large kettles. 37. H6 Bugfix: Item Menu: Hey there, This is a book fix lecture. Verily, fix a bug with the item manual. No, this might seem like a weird concept, but you can actually learn a lot from analyzing why certain bugs happen. Service harder to do a separate lecture on this. If you're under game now, you notice that the item menu is not appearing. Why is that? If you open Oita menus create event, you'll see that its size and position are set. According to Giorgio earlier size. You're setting the size order do earlier in all managers Room Start event. So the issue here is that the item menu is getting the wrong with you earlier size. Why is that happening? See, previously we had the camera court in the creative it. So it would said that US size in the creative it drained Item Menu's great event. It would get the correct US size. But now the camera cord is in the room started marriage, which runs after the creative edge. So here the item menu takes the DeForge earlier size, and then that you are size is set in. The room started bad, so that's why the item menu doesn't appear it using the wrong resolution. So to fix this, I'll go to avoid a menu rightly conducting elevate. It's like ginger mint and 32 rooms start so know this will turn in the room. Started right after that. You earlier sizes set. So if you're on the game, you can see the item menu here. Now let's continue with the next lecture. 38. H7 Shadows: Hey there in this lecture, Willard Circular Shadows in our game. The shadows would be drawn to a surface as white circles. Then that's enough. It will be drawn in the room with a dark color and a little for Why are we doing this? Let's say we draw the shadow circles independently and not on a surface. If two shadows are overlapping than their offers would add up like this, we don't want that to happen. Snellville, Georgia. Shadows to a surface at full Alpha the reuse all for order, whole surface android so that we'd all for Mr the Same, even when the circles overlap. So that's got to game maker. I'll open all manager and go to its great event. He allowed this. This very able will contain the surface for the shadows. Here I'm creating Guardia's list. Cornel Shadow. This will contain the objects that should not catch potato, so I'm adding the manager itself. DiVall object the house front object house side, the door or exit and the item menu. So the shadows should not appear for these objects. No, I go to a draw. Big internment and our this when the total surface doesn't exist, it will be created. It signs will be the camera's eyes. No wonder the simple driving and our days in dissident will be joined the shadows. We're using a draw event and not a choice. You event so that it grows in the room and nodal no joy. Layer these variables. Look at the position off the camera. This will said that draw targets to the shuttle her face, and this will empty it by feeling good video. All far. You should do this before drawing to a surface or it won't clear the last frame in disagreed function. I'm using the all keyboard. So the accord in this block will run in all of the stances DS list, Find Yandex Garza position off something inside a list, and if it doesn't exist, it redounds minus one. So here I am, checking if that object exists in the notion rollers using your subject index that tree able stores object. It is like, Oh, player, Oh, item. And so on. Before the last name, I'm using the other key word because this court is running inside all the ordinance stances . So to access for Ebel's from the oil analyst, US there is no manager. You have to use the other key word. Not this will check whether that objects does not exist in the list To make sure that it can have shadows. This is diverted Fajardo, which is well, I'm dividing goodbye to because we need half values for drawing a shadow and the highlight it just cover it multiplied by 0.7 These very able Zwicker deposition off the shadow on the surface by subtracting the camera position from day stances pollution for the Viper vision . I'm using Reeboks boredom instead of why so that the shadow appears at the bottom of the object and not on the center draw Ellipse will draw And the lips, which is a circle with a sergeant, were 10 height. It was a traveler. Shadows were 10 high. It's for mature operation for the first point and add them to the position for the second point. I am also subtracting one from the second point is that it appears correctly this Ezio so it will draw filled ellipse. This will reset the surface target No one Our deuce. This is the Calo the Shadow, which is the night color and this is it's all for display. Jola Cheryl Her fears using the extra function, it will draw it at the camera position. Dissident scale. This is a rotation. This is the color and this is the Alfa. Now we're in the game. You can see the circular shadows below the objects. Currently, the shadows will have the same size for each object. If you want to do in the feral size for some object, go to a draw event and go to the part where the researchers said after it turned over it. Bear, don't you objected next. So if that object is Orel Dennett shirt over, it would be Tony. Do this well, you can Gina channel size for each other. This a dirt an example. So I remove it. Now let's continue with the next lecture. 39. I1 Pause Menu: Hey there in this lecture of will implement a pause menu, we get a very able court will propose that the store, but in the game is paused. It will be toe goldband Escape key is pressed when the game is supposed, all the instances will be deactivated and oppose many objects. Oppose Menu really created this subject will show them any options. When the game is assumed, all the instances will be activated again. Soldiers got to game Maker I'll open or manager and go to a scary moment. He released Last Global Pause at Falls. Now we'll go to a step event and at the top. I like this. Here we make the game post or resume. If the escape key is pressed, then the poser able will be toggled safer, destroyed, all gone force. And, if it is false, it looking true. If the game is posed than this, will deactivate all of the instances. So everything, including the player, any movement. NBC's will stop working here. You can specify whether the sisters chairs active or not, since I'm starting this to true or mansion below. Deactivate, destroy, create an It starts off Opals menu. The Postman you object that we create in Step two. If the game is resumes, then always transfers will be activated and the opals onewest also been destroyed. Nordea. And if the game is paused, then the event will exit. This means that die eventually stop there, and 1/4 for this line will not run. So this, with a cloak, will know turned. When the game is paused, I'll open and step and are the same. But it stopped. Hello, controlled you. Why another two year as well? So these events will Norton when the game is pause. We're doing this because I am talented, are deactivated and according disappearance would not work because of that reason. No wonder objects. I'll go to Joe Y and create an object called Opals Menu a lot of creative mint and are this year here. I'm setting up the many options in an in, um, so the three options would be resume, save and quit. This are able show that text for all options. This very able will store which money option is selected, and this variable stores the total number of options they getting the size of the menu dictionary. No wonder the step It burned and heard this year this look at the political access on the keyboard. So if they're down there, oh is pressed, entered on one. And if the upper express it returned last one dent catch value will be added to the menu selected, very able. So by pressing the up and down keys, you can go through the money options. When the menu selected very able becomes larger and the last option, it'll go back to zero. When it becomes smaller than the first option, it will move to the last one. So this way you can go from the last option to the 1st 1 and why Source er now alert this when the enter key expressed desperate and a switch statement learning different chord based on the selected option. So if there is you motion a selector die stances will be activated. Global Post will be set to falls and this instance will be destroyed. Nothing will happen when the save option is selected. Will called that part in the next lecture. When the quit option is selected, the game will restart. No, not that Georgie y haven't honored this year. These were Abel's. We could divert and height of the joy earlier. We need to make the screen dark when the game is supposed Saavedra Black Rectangle dispenser doll for 20.5 and this one's hard knuckler to Black. Then this will draw rectangle to fill that you while air than the all phone call ever be reset. This is the position of the menu on the Jew. Earlier, this look will go through all the many options so that they can be drawn one by one. The options are the selected will be drawn at full, Alpha and all the others will be drawn with an Alpha of 0.7. So if an option in the loop is north selected than the Alpha, if he's had 20.7, this will draw them a new text from the array. It will increase the height by Tony Drew for each menu option. Then the Alpha agrees, said to one. Now we're in the game. When I hit escape, you can see that the game porters and a menu appears. All this transit disappear because a good deactivated you can move through the money options and select resume to continue the game. Now let's continue to the next lecture we will implement to save system 40. I2 Saving: Hey there in this lecture of a little burn saving in our game So we'll be able to save our game so that we can continue it later for this really use DS maps. You know, about DS less? They contained it out that you can access using numbers. DS maps are very similar. The only difference is that instead of numbers, you use text keys to accept the data, and the excessive for a map is a question mark. So we store save data in a DS map, a news, the function DS map secure, safe to save it. Desperate encrypted data so no one would be able to modify it. That is the reason we are using the S maps and no, the anti fires, which can be easily cheated by anyone. So that's got to game maker. I'll open Opals menu and go told step event Under. Those were statement in the case for the same option on our days. Describe Creator new DS map and storied Saidi In this very able deploring stars will be activated so that we can access it for Ebel's. You can do that while it's deactivated, so we have to activate it here. I'm creating a key called X in the map and sending it to the players expedition similarly and storing the players. Why, Spn Stamina as well, then I'm storing the inventor in the map to do this. Need to convert in Montreal East into a string DS list. Right? Does just that, so the list will be converted into a string and saved in the map. Then the room and time will be saved in the map as well. Then, using DS and AB secure save the map will be siento that is, this will be the name of the file. Then the matter precluded from the memory. Then the never be deactivated again because the game is paused. Then the text for the same option would be said to game saved so that a player knows that the game has been saved. Then Alarm zero D said to run after 30 cents. No other Dellums irreverent and are this year. So after these tabs, the save options text. Anybody said to see you now in the game and I will open the post venue. If I save the game, you can see that it shows game saved and then goes back to save. Let's move on to the next lecture. We will make them in menu and then the loading. 41. I3 Main Menu: Hey, there in this lecture will are the main menu. It'll be Gordon, mostly the same way as opposed when you. So let's get into it. Create a new room for the menu. An image are a menu I'll drag it with at all. For that, it opens first. Now I'll go to the objects and energy. Why create an object called Omen Menu? I learned a creative and and are this year. This is pretty similar to what we did in the polls menu. These are Germany options. Desire their names. This is a selected very able, and this is the total number of options. The T options in this man you are new load and quit. No, let the step event and are this year. This, too, is the same as the court and oppose menu so you can just cope. Your separate meant, though you will have to change everything inside the Swiss statement. When newest elected, it'll go to the ballroom. When Lord selected, it'll do nothing. And when quitter selected it, learned a game. We'll make the court for the Lord option in the next lecture. No wonder that Georgie, why haven't and are this year. This is exactly the same as a postman used. Georgie. Why event? So this will draw all the menu options. Now the Manu has been set up, so we need to set up the resolution for the money room. For that, I'll go to a manager and open the room start event. Also been over. It heightens Calvary Ables and passed them in Omen Menu's great event. I'll go back to a manager and also copied these three lines and then paste them in. The main menu is great event. It's another resolution, and window size will be said correctly for the money room as well. Also are this year. Distance air the room size to the resolution. Now open the money room and play so many menu here. I learned the game, and you consider the game opens with the menu. It was like new. It starts the game by selecting Quit from the Bozeman You. It takes me back to the main menu where I can get the game dollars. Continue to the next lecture of Able Implement are loading 42. I4 Loading: Hey there in this lecture will implement loading in our game first will called the Lord Ocean and I mean menu And then the actual lording off the data from the safe file, soldiers kept a gamemaker. First of all, I'll open the Arab World Room and from here, delete the Omidyar instance. I'm doing this because we create the manager using court. Just we will be able to create the manager in any room that gets loaded no open or main menu and go to its great event. He initialize this very able. This was toward the map that we load from the safe file. Currently, I'm selling Mr minus one so it doesn't hold any map yet. Now will open the step event. And in the case for MP new, which is a new burden allowed this this will create demand. Your objections removed it from the room. No wonder the case for MP load, which is a load but an alert. This dis reject what it does a file exists. This is an end abused while saving the game and oppose menu using DS met secure sale. Swifter file exists The map reveal order using the ESPN and secure Lord into the global Lord memory ever. Then this. Look at the room saved in the map into this very able. It would change the room to that one to load it. Then the mansion object relegated. Now the else part will run the safe. I doesn't exist. In that case, it was said, the Lord Options text to know, Say phone to tell the player that there is no safe file. Then to set the alarm 0 to 30 for is heading this text? No. A little Andrew event and our this year. This research the Lord options text to Lord. Now we're creators. Script a name it Lord game. Yes, I did alert this. This will get the mad there was ordered from this a file and Corporates idea into this local very able called map. This will no duplicate the map. So both of these were neighbors were friends the same DS map. So there is a mere doing days so that it's easier to type the map name since this name is shorter than this one. This project with the current room is of under two saved in the map. If it isn't over even probably stole it from the map. So the players x Y coordinates at being stamina. We restored. Yes, let's treat converts a string into a list. Since we saved our 20 list as a string using BS, let's write this look at that string and apply it to the Mentalist. Then the time people used toward under the end that memorably destroy now will open or Manager and Gordon's room start event here like this, the function DS exists checks whether the securities is so. Here we are checking with Dirty s map exists, which is the Lord map. If it does exist, which means that the game was loaded in the Lord landscape will run on, the variables will be loaded. No, I learned the game and start a new game. When it's night, I'll save the game and quit. Now I can load it and it works. Phillips will want to the next lecture 43. I5 Bugfix: House Exit: Hey there in this lecture will be fixing a bug. The book will be fixing Happens when you save the game inside the house. When you loaded back in Lourdes Fine ribbon. You go outside the room. It doesn't put you are correct door. This happens because it doesn't know of which How's your coming out off? So to fix this with shorter idea of the door in the exit object centred. It puts a player in front of the correct door. So let's get to it. I'll open RM World and go to the door. I'll double click on it and Jane Distance chances name to Door Von So when you say Jorvan, it refers to decisions only. No, I'll open the house room and directly contacted object. I'll open its creation, called and said the variable door i d two door one. So this will start a door that this, as it object, is connected to No, we need to save this door. I d soil open or exit and go towards step event here where the room is change on contact with the player. I like this. This will open the tender and I file and save the door. I d using this key under the section now will open up the object and go to the room start event where the contents of the temperature and a file are loaded after the loading of the HP and Timina other. This this will load the door. I d into this local very able. If the door I it is not found it, Lord no one, which means that there is no instance If that door riding starts exists, the no player will be moved to that end stars. But 20 pixels blow it Now we're in the game and loaded. If I go out now, you can see that it puts me a doctor tells No, not continue to the next lecture. 44. I6 Menu Mouse: Hey there in this lecturer will implement most input in the menus. Here's the menu. The most important work by cutting the relative position of the mouth from the top of the menu Doctoral declaration would be divided by the height of Egyptian, which were down the option number that the mosque is on. So let's go do it. I'll open Opals Menu Al Goddard Step event and hear about this. This is the position of the menu. The same Isn't that Giorgio event? Disregard the axe and reputation of the mouse on a joy lair now dislike adoption the most his own. So this look at the relative most why was subtracting the menus? Why from the most is why and dividing that provision. Why try to sow doubt at the height of Egyptian in the rodeo event now here to conditions? This will make sure that the most auction is at or above zero and that it is below the total menu options so insured it makes sure that it isn't a man your age and not outside of it. If these conditions are true, the nominees selected very able will be sent to the most option No after this condition, very jacks with the enter key was pressed about this. Now you're gonna also like them a new options by using the left mouse button. It's like discord, including the mouse input gored. And these two conditions are good Control C. J. Corbett 11 Orman menu and go to a step event as like these two lines and use control V to paste our court here. So now the most input court should work for both menus. I learned the game, and you consider the menu works for the mouse. This makes it really easy to navigate the menus. Now let's move on to the next lecture. 45. I7 Audio: here, there in this lecture of black music and sound effects in our game. Implementing music and sounds is really simple once you know the functions. So if you already know how to use all your functions to play music and sounds, then you escape this lecture also, nor that I will not be adding sound effects for every single thing in the game. I'll only be adding a few to show you how the are the functions work. So let's get into it here. I've created 37 resources. This is the music. This is a sound for the many options, and this is a door sound you can find. The sound files in the resource is IP. After creating a sound resource, you can import a sound file using this, but, um, introduce their music volume, since it is louder compared to the sound effects. No open Oh Messenger and Google's create event at the Topol. At this, this will play the music when the manager is created. This is the music that will be played, and this is a priority. It shouldn't matter at this point, so we'll just headed to one device tells what the sound should loop or not, we want the music to repeat so prints that there's too true. Now open the game and defend. And at this year, this was dropped, all the sounds and the music. If the game is closed or he started, no will implement the menu sounds. Soil open, Opals Menu and Gordon's Create event here create this variable. This very able will show the value off the menu, selected very able from the previous step so that we know how the variable is changing now will open the step event and at the beginning said they're very able to manual selected no after the most input code alert this. This will check whether the Manu selector very able is not equal to the manual selected previous very able, which means that the money option was changed in the step. If that is true, then the menu zone will be played. We don't want a sound of extra loop, unlike the music. So well said this too falls. No, you should do all of this and I mean my new object as where to enable the sounds there. No, I'll open the door object. I'll go to step event. This is a condition where the does animation is played. Wenda Player enters eight solar. This year, this will play the door sound. No other in the game. You can hear the better music when you enter. Adore it plays. It sounds world on the menu. Zones work, too. This where you can easily add sounds anywhere you want. No, let's continue to the next lecture. 46. J1 Hit Cooldown: Haider in this lecture will implement a hit Golden Let me show you way we need it. The health of the player here is 100 attack power off the enemy is 20 so it should take five heads to Gilda Player, but here it only takes two heads. That happens because as longer the enemy is touching the player, the health will go down by 20. So if they keep touching for three frames, the health will then go down by 60. This can be fixed by implementing a hit cool down. We create a cool on variable at zero. Then we'll make it so that a player can only be heard if the cooled on value is at zero. When the enemy attacks a player, the cold on variable will be set to 30 and it step. The cool on value will go down by one. So this way there will be a Tony step delay between the hands reductions, and it won't be continuously drained. So let's go do it. First of all, I local no player and open the create event under very Abel's all create cool donors. Zero now will open the step event and scroll down to the enemy collision part. After these two conditions, I learned another one for the court. Here we only run if the cool on value is zero. Then inside the court, look allowed this. So when the player is attacked, the cooled only said 2 30 No, a scroll all the way down and at the end. But at this, if the cool down is greater than zero, it will be reduced by one. So this will happen each step until it reaches zero. While the cool down is above zero image. Alfaro will be reduced by their 00.1, and when the all for it zero, it'll comebacks one. So the player Wilkie blinking. And if the Kool Drone is zero, the alphabet you said to one nowhere in the game and go near an enemy. You can see that a player blinks after being hit, and it takes exactly five hits to kill the player. Now I have shown you how to implement a cool down in the player. Your challenge is to implement it in the enemy as well. So that's all for this lecture? No, let's move onto the next one 47. J2 Gamepad: header in this lecture really are gimp at import to our game. For that, we lose our sync system. Event data event runs whenever our game pad is connected or disconnected, and it gives you the I d all of that game pad. So let's get to it. I'll create a new object and limit or game pad controller. I make it persistent for the chairs and all rooms. Now we'll open our menu and plays the object here. No in the object. I led the create event here and create a global, very able Call GP, which restored the I D off the game pad. So for now it's at minus one. Now we'll go to events and under us and groaners either the think system event inside it allowed this this event, Lord, some data in RDS map data from RDS map can be loaded using a kosher market presser. So disregard Ivan type and this will goodbye index off the game pad if time when type is game pair discovered, which means that a game pad was found. And if Global GP is at my Aslahn Global GP will get the game pads and eggs and if they've been type is game bad laws, which means that a game pad was disconnected and the game pad is connected. Is a one in global GP that were able would be set to minus one. Now will open no player and go to the step event after the keyboard input code. At this, dis checks whether drug impaired is connected. If it is, it gets a import ex and input. Why values from the game pad axes, which is the stick? This is the gimp A to use, and this is the access to get here, says L. Edge. So it means that will get the horizontal axis from the left sick. And here you says L V. So disregard a political exiles from the left stick. The exes are in a minus 1 to 1 range sorts minus one for left and up, and one for right and down. Daniel checks with a player is attacking by checking whether the GP face to button is being pressed. The face to button is the B button and distracts with a player is running. So this check the right shoulder, but and also checks with the stamina is above zero Now we'll run the game, and as you can see, I'm able to control the game with my game pad. I can't even move slowly with a stake. Now your challenge is to implement game pad input in the main menu. So that's all for this. Lecture notes move onto the next one. 48. J3 Conclusion: Congratulations. You have completed the course. You know a better game developer than you ever were. If you ever feel like you need help with game maker and you want the quickest way possible , you can join our discourse server using this link. You can also find a link in. The resource is off this lecture. If you have anything to say about the course, you can give it to review I would appreciate it, Lord. So I hope you enjoyed this course and I'll see you in the next one.