Build a Platformer with a Story - GameMaker Studio 2 | Gurpreet Singh Matharoo | Skillshare

Build a Platformer with a Story - GameMaker Studio 2

Gurpreet Singh Matharoo, GameMaker Mentor and Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
26 Lessons (1h 12m)
    • 1. Class Introduction

    • 2. A1 - Intro

    • 3. A2 - Player and Tiles

    • 4. A3 - Camera

    • 5. A4 - Attack

    • 6. A5 - Enemy AI

    • 7. A6 - Enemy Death

    • 8. A7 - Lives GUI

    • 9. A8 - Player Knockback

    • 10. A9 - Coins

    • 11. A10 - Audio

    • 12. B1 - Intro

    • 13. B2 - NPC Messages

    • 14. B3 - Levels

    • 15. B4 - Debug Score

    • 16. B5 - Water Tiles

    • 17. B6 - Inventory

    • 18. B7 - Inventory GUI

    • 19. B8 - Pause Surface

    • 20. B9 - Boss

    • 21. B10 - Lock

    • 22. B11 - Boss Music

    • 23. B12 - Game Menu

    • 24. B14 - Story Intro

    • 25. B15 - Save Load System

    • 26. B16 - Parallax Backgrounds


About This Class


The Class

Welcome! This class is about creating a platformer in GameMaker Studio 2, using GameMaker Language (GML) coding.

It covers many topics, from platforming with tile collisions and finite state machines to data structures and surfaces. Using the skills learned in this course, you can build a complete platformer with your own story!

Not only that, but the knowledge you gain through my lectures will benefit you in making any kind of game, no matter the genre!

GameMaker Studio 2

GameMaker Studio 2 is an amazing 2D game engine, made by YoYo Games. It is easy and effective to start with, and great to work with bigger & advanced projects.

About Me

I have been with GameMaker for a long time, and I love making games. But more than that, I love teaching others how to do so. I have been an instructor on Udemy for 2 years. I also have a website (GameDev Palace) and a YouTube channel (GameMakerStation). My courses have a 4.5+ star rating.


With this course, you also get a free link to my pop-up textbox asset, which is a paid asset on the GameMaker Marketplace. In the course, I also show you how to use it. It can prove very useful while making games!

So, check out the trailer and the preview lectures to see if this class is for you.

See you in the class!


1. Class Introduction: headier and welcome to my course. This course is all about creating a performer with a story using chemical studio to I'll be using chemical language to court the game. Throughout the course, I'll guide you through everything required to make our game annual on men, different skills such as performing type 1,000,000,000 state machines, researchers and much more. You can also don't over next file and sprites for the game with making the course and when you finish the course who had the skills required to make her own awesome like former and it would be much better at game development, so hoping to the course and that's got started. 2. A1 - Intro: Hey there! And welcome to this section in this section the start making our platform a game in the game abusing prima graphics. So if you want to follow my example, you condone on all of them in the resource of section off this lecture. No, let's get going. We don't next lecture. 3. A2 - Player and Tiles: Hey there. And welcome to this lecture. In this lecture allowed tiles make the pair object and implement our collisions. So start you need to create a new G. M l project. I already have some sprites in the project for the player and the tiles. You can find these for download in the resource of section off the previous lecture. So first of all, I make a trial said on David t l mean and use my time despite here. And I said the size of the ties going toe a size of the tiles in must right, which is starting to. But I do. No one said these tiles for driving using this 16 times that here. And I was like their element tiles here with the white part is the block? No. When it comes to the last tile time T one make shows like this one. The wonder just empty on the top left. It has to be an empty title. But it can be any off this one. It has to be this one or the collisions won't work. No, I'm done making this time site. So I closed this No oil up in the room on gender room height 23 84. Now I look in the back only er and touch a color for the sky. Now I click here to create a diarrhea and name it tiles underscore main Heracles, like the dial said, I'm going to use and it's like D l mean and using this order title tool. I can create my level. So now that I'm done during the level, I would make the player object. So now we'll make the player object and name it over Jebalya and I use the sprite. First of all, honey, don't each life some variables which I will do in the creative. And here move speed the speed and with a pair of remove jump speed, it's a jumping speed and grab is a gravity. And here I just be nbsp on the horizontal and vertical speed variables will use in the strap event. No emission lines are states, and in, um in a group of indigenous So here, normally zero attack this one and heard this too. So this is an order. So if here I add another state, it's really will become tree. But the very real doesn't matter here because we're just going to use the names. So here, the able state is going to store the state appears on. So here, as he is, the name of the inner and normal is a member off the end of my amusing. So this can be attack for her. Based on the state. I want a player to be on next. I relational eyes that I am a variable which will contain that I let up on the Tyler inside the room so that I can use them for Killian's. I will do this in the room start event, which is inside the other category. I'm doing this in room start because when the player object, enter the new room it needs together tie. Let up on the layer inside on your room. So here I die inside dysfunction. I'm using the name ties main because this is the name of the Tyler inside my room. So make sure the name is correct in your project. And here I'm making this way of the global because I need to use this in other objects later on. No other doctor prevent. And here I let us switch statement. They're switched depended on different code based on the state dumb players his own so disinterested variable I created here. And this is a state after normal. So when the state is a key number, the court after this case and before this break will run So similarly I can another case here for say, s t attack. And here then add another break. So if the state is esti attack, the court here will run. So now I just need the normal good. So I remove this And inside the normal state I learned some core in the first line in this assignment door. Just be the first part here, will it on one if I dirty All right, Case pressed on the second part Heavily done one if either a or left expressed because I'm using the or symbol here Then I'm subtracting the second part from the first part using this of tracks and we're here. So this way, if the right key order deaky expressed this will become one and this will share zero So I just be will become one mile zero which is one But if left key or a key expressed despite Michelman on this part will stay zero. So I just people become zero minus one, which is minus one. So this way we can use our input to moved up there. And then here I am, well, deploying that just be variable with the most weed which finished lives in the event after dead, I'm creating a local variable called Jump, which doors whether the WG or the up gay expressed no before adding, for the record, I need to create a script. A script is like a custom function that run some cold, and it earns our value. So here I get a script and name it tile underscore hole on this conclusion. So as on the inside jets descript will check for decorations was only and here on earth, some cold in the script, you have to pass only one argument, which is a horizontal speed off the object. You can read that argument using the valuable argument zero. So here are taking. If the horizontal speed is gated and zero, which means the player is moving to the right, the site to check will be said Toby Books, right, which is the right most edge off the Objects collision mosque But if it's no good 10 0 which means it might be moving left, the side project will be said. Toby works left, which is the left more side off the oxygen mask off the object. So here I Miss Norton function that I don't function, and the script and unions are value here. I'm using the function tile map. Get at Pixel Richardson's the idea off the tile at a position inside a tile map and here, building the global dinette we neutralized in the room start event. The first function export tile and the horizontal side to check. That's a speed past in the argument and vertically and adult most edge off the mosque. The second function does the same, but at the board image off the mask. So since I'm using the or a better here, if any of these functions find a dial, this will return through on the escape. Will it untrue? No, I need to make another script, but for checking particle collisions. So I duplicated the script Aunjanue, its name Hotel were collision. I'll open it and make some changes here. Send the script jacks for body conclusions in your target. Better Unit was better. Find out what God's spirit. So here, if the vertical speed is getting an zero, the site to check will be said toe the bottom edge of the mosque. But if it's not greater than zero, the site to check if they said Toby Bookstop, which is the top edge of the mosque. So here dysfunctions, check bro tile vertically, where one function tricks and the left edge of the mosque and the other on the right edge. No, I'll go back to the supplement and here on the jump court here if the jumper you. But it's true and there's a title. One pixel blowed a player. The VSP will be set to mileage on speed, which will make the player jump. No other. The movement court this condition Jack's poor hose on a collision. If I was all the cretinous found, the player is one closer to the dial to cover any distance that might be there. And then I just is a 20 so Danda player stops moving horizontally. The saying is done here with nobody pavilions. Then I just be is under two X and VSP is very toe by toe. Make the player move. Also, the function org is only used for words and not for the vehicle variables. So if you have an org function around an Ikea variable, make sure you remove it. No, I learned a gravity court here, So if the air space more than 10 the scored will end the value off. Grab Toby A speed. No, I look in the room and place over your player inside it. And now we're just a game. You can see that the controls work perfectly with both Iraqis and that, um, um, Dickie's end up that forming works as well. Jumping, gravity and everything. No, you can adjust up. They reproduce like the most be jump speed under gravity to your liking. There is a lot for this lecture and I'll see you in the next one. 4. A3 - Camera: Hey there and welcome Good this lecture. In this lecture, I would make the camera and implement player animations. First, I'll make a camera for that. I love of knowledge, a player. And at Gordon Sayda Pate event this line enables of use, and this line makes the first few visible. And here I am initializing three local variables. One for the weight of the camera, one for the height of the camera and one for the scale of the window. Then here, dysfunction is creating the camera and storing it inside a local variable called camp on the camera before low budget Player. Yes, function applies the camera inside a variable camp to the view. And here these two functions Jane the size of the game window on the game surface by multiplying that came out of it and hide by the scale. No, I was just a game. And you can see that the camera is working fine. And this holding up earlier. So I have some strikes here. One for Ida, one for moving, one for jumping, anyone for falling. But before implementing days, I will create a mosque, right? Because when you change a sprite for animation, the Masters as well. So it's good to have a separate masks, right? So for that I will duplicate this idea Sprite, and you name it to SPR player Mask. No, I'll open it and remove the second cream. And I did. And here put black rectangle. So this will be the original mask off up there. Soil open on a player and drag and drop This month's right here and now will implement an emissions inside the step event. So here at the end, I lad. So this Corporan a fertile is your phone below the player. So here, if the VSP Smolen zero, which means up there jumping the sprite, we decide Trojan Bates, right? But if it's north Golden zero, which means that a player is no jumping on the Sprite would be settled avoidance. Right? And here I like more court. So the else partner on when a tile is phone blood, a player which means up there is on the ground. So this condition checks and I just be it's nautical zero, which means that player is moving horizontally and if the here is moving, then the sprite will be assigned to the moving Sprite and the image X scale, which is a little science of this parade, will be set. So the sign off to speed the function sine returns one. If the value is positive and minus one if it is negative and lastly here that so if the pier is no jumping and is not moving, the sprite will be sent to the idols, right? No other. Just a game. You can see that despite clips when you change election and animation works well for jumping and moving. So that is all for this lecture, and I'm seeing that actually. 5. A4 - Attack: headier and welcome. Go this lecture. In this lecture, I will implement dart extra aid in the player. So I haven't attacked any mission here on this is the an emotional implement. But before doing that, I need to create another mosque, which is for that exterior. So I duplicated this mobile mask and change its name to SPR Player mask attack. So this is a mosque for that extra. I don't need it. And here extend dissect angle of it. So know that this mask is bigger. It will be easier to hit. The enemy's went up here is attacking. So no, I'm never this cycle of this. No, I look when I was a player, I love women. Step event. You can see you down. The type event is getting bigger. So I will move this time here in a new book space. And here we learned that X tape with this case and a break. So in that ex state, I learned some gold. So this will change despite toe that exploit. And this will change them. Ask toe the attack mask here on the top of the normal state I lead. So this was said them ask to the Noble Mosque when we come back to the normal state? No, I'll implement that. I can put for that. I look in the create event and here I'll make agreement, called a tacky and said There's too big a space. So this will be the attack e No, I'll open the step event and at the end of the normal state, I like some court. So in this court, when that tacky expressed and a player is on the ground, that's creating to be chained to the tax day. But there is one thing and it gave in mine. When you change us pride, the animation is not reset. So every time a general state and the spider stand, you need to reassert the emergent exploitable. So four dead. I would make a script on name it, State said, and had some good here. So this script will change the state wage on the argument and you send a 1,000,000. Next. Were you able? So each time, would you inducted? The animation will really said so here. Instead of this, I will use my escape stage set and in argument, I'll add Estephe Deck No, at the end of the attack state I love here. This condition will check when the dark tax and emission is ending. Imagine Decks it Sasabe made inspired his own. And it made number is a number of sub images. There are in desperate in total. So every number miles one in the last Imagine nets. So here I am, flooring the value off. Imagine decks to get any leader value on checking Deputy is equal to the large frame. If it is then after it will be said to normal and now order in the game And you can see the dexterity in action whether breast base, the bear decks that is a local this lecture and I'll see you in the next one. 6. A5 - Enemy AI: header and American Voters lecture in this lecture, I will make the enemy object. So this is the enemy's right. I have only one booking animation. So inside the objects I led a group called Enemies and create an object here called VJ enemy zero and understand this right and inside you Discredit meant, I'm sure, lies some variables the function tools, selects and random value from its arguments. So here just be will either be said the move. Speed metal, make it move to the right or mine a small spirit which will make a move to the left. And then I'm setting industrial toe after normal. No other. That's peppermint. And here and that's what statement for Dusty and inside the normal state. This is supporting court. So if attire is no convoluted object, it will fall down. No, I learned of or reduction goals, so this condition checks. If there's a tile in current of the object, if there is the sign of a chest, pain will be flipped, so every displays they will become negative and vice versa. So the objectively of directions and now a little introduction Cool. So this collision checks if the land load object is ending if it is. Then again, it changes directions. I know. So this line flips us private necessary. And this applies the movement? No. I'll open the room and play some instances off than any object inside it. And no, I don't mean you can see they're not. Enemies are moving and they don't around going to see a large or a wall. So there is hope for this lecture, and I'll see you in the next one. 7. A6 - Enemy Death: head there. And in this lecture I made enemies able to be killed faster fall. I love one over here and in a spirit event in the stairs. I'll add that state. No, I look on that, Um, you object. And in experiment I'll make an SP variable. It will be its health and such a dodo. So it will take covert stupid landing me so you can change its value if you want. No, I make two more variables. Gave me extra abuse for the locked back and enemies hit and came the speed within the speed of the love back. No, I'll open the supplement and inside the normal state and the end island here, if there's a query with Reappear Onda Player is attacking can be expertly set to the sign off x minus over your Players X, which will make the object move away from the player. And it made X scale. We decide to minus K B X, which will make the object faced up here. Then, as people were used by one and the state will be sent to the heart state. No, I learned the hard street here before a record to the whole state. I make a table all the time and try to do Leo. This variable will be used to stop the heart. Stared after some time. No, I'll open the step event and inside the altered our disciplines. And despite to the hearts, right, this will add gave me XTO, the axles object multiplied by KB Speed. This will add one to her time each step, and when the time becomes greater than for, the state will beside toe the normal state and the hard time will be sent back to their no . Here, I'll add in the recognition. Let's protective. There's a tile where the object is going. With the log back experience, this condition will become true and the state will be sent back to normal. No, at the top of the normal state I lead. So this was had this pride back to the normal one. When we come back to the home state. No, if you're in the game, you can hear Danny's and see the note back connection. But if you make their enemies fall off a ledge, you can see that this happens and the falling is very pretty. Two fixtures inside the normal state allowed this condition. So this way the object will only move if it is on the ground. So the alleged attraction animal attraction won't work If the enemy is falling also, I'll change that. They have the speed to four. So it falls more okay. No, you could under him. And if you make it fall over, you can see that your books large. No, are deployment of that state. So here I learned on that case, this one sent us right to unearth Sprite. And here, if the animation is all the last frame than dying stars, we would destroy no and the end off normal state here. If patch be smaller than or equal to zero, the state will be sent to the That said so. No, I just don't get. And here you can kill the enemies. Where do it's Oregon? Fall off. So that is all for this lecture, and I'll see you in the next world 8. A7 - Lives GUI: Hello there and welcome goddess lecture in this lecture. I'll make the players lives here. I have this art right. This will be used to show home a life stop here has. So to start, I'll open a video player. And in a squared event, life lives equal to So this is a built in global variable used for lives. And I'm having just a tree. So this is an abrupt life's appear well started. Now I need to draw the hearts. I draw them on the you earlier, but you earlier is alerted. That shows up on top of everything. There's no game. The jewel ear science is the size of the game window, nor the camera. So I need to change its size to the size of the camera. For to do that, I'll add a function here. Dysfunction Jr is a science author. You earlier on answering, get rid of it and hide off the camera. Now I'll add the draw, Geo, I haven't from here. I would think a row inside this event has drawn energy while here. So now I create from local labels here. So here grow X andro. Why are the positions where the lives will be drawn. And at this is a whole lot of distance between each heart. So here I learned a four loop. This loop starts at zero. And then Jax, this condition, If this condition is true, this cold runs and then discordance very dark one. So I and again this condition of stepped again. If that's true, the Gordons and one is that it. So just wear This loop keeps on running until this commissioner's falls when the blueprints . So this look looks through the lives and for each life in told one heart and are on television over hard and different because off this part, when the horizontal position is dependent on I so no, I don't love him and you can see the hearts here and it all the stares on the screen no matter where the camera goes because off the juelia. So that's all for this lecture, and I'll see you in the next one 9. A8 - Player Knockback: Hello there. And welcome to this lecture and this lecture. I'll make the players hard state. First of all, I'll open the enemy's fuller inside objects, and here could an object called garbage enemy. This will be the parent object for every enemy recreate. So I'll open this enemy and in experience section I'll assigned this object as experiment. So now I clauses. Now I look wannabe player to make the hard stare. There's going to be very similar to what we did in that any object. So in the period event, I read some variables here. So these are the low back variables, and this will be used to end the hearts it. Now I'll open the step event and inside the normal state at the end, I lied, dysfunction returned. I just I d off time stuff that's gliding with object layer. The stars can be any child over the enemy and that incest I d will be stored inside the variable enemy coal. But if there is no collusion discovered, no one will be store inside a variable. So in this condition, I'm jacking. If this variable is nautical, you know, one which means there is a growing. So if this is true Oh, baby, actually set to face off from the enemy and a major X scale, we decide to buy the scape e X. So there is a small just that image Excalibur it on zero. So if it is zero, it will be said to one. And then lives will be reduced by one and the state will be sent to the heart state. No, I learned the whole state here. So this is exactly the same as our stared inside enemy object here the sprite assert. And a lot because it light. Then her time is increased by one. If it becomes created and for or abolitionist phone with a knock back a scoring then the state you said to a normal state and her time is reset. No, I create that that stayed here. So this will send a sprite? Were That's right here. I'm checking. Your generation is on the last frame. If it is, then animation will be stopped and her time will be increased If the heart time becomes content and then the room we restart for now, I'll go to the end off the normal state. And here lad. So if the lives raid zero or the players, why becomes greater than the room height? Which means a player has fallen below the role that stage will be set. So that that state I know we're in the game. No, If we don't, the enemy you can see that you lose a life. And if you lose all your lives, you can see the nuclear dies and the room restarts. So that is all for this lecture. And I was here when not actually. 10. A9 - Coins: head there and welcome to this lecture. In this lecture, I'll add corns to the game. Here I have a coin Sprite and a cornerback animation, which will play when we climbed the coin fall and integrate event. Here I get a variable called coins and turn into the road so dismissed or the number of coins appear has collected here. Let a group called items and create an object here called or Bridget Coyne. And I look fine despite here. No wonder the great event and here grade a variable called Elected and such a dough balls. So why don't we collect this school and this variable will be sent to true? So they're the Coen effect. Animation can be playing. So no, I learned the temperament and here I learned some court. So here, if the player, if flooding with that going on the collective variables falls, the coins were able to be created by one Imagine that will be hard to zero so that the effect animation place from the start and the way we collected we decide to true here. Before this, coins were able I'm using or video player and a note because this coins were able belongs to a bit a player. So I have to do this to be able to access this variable. So here I learned some more gold. So here, if collected, is true, which means that coin has been elected. The Sprite will be sent to the going affects bright. And here if the animation and judges its last frame that night stars will be destroyed. So now I look in the room and play some going things I did. And no wonder. And him. And you can see that the coins are animating and you can collect them by talking them. No, I'll make the Jew I for the coins. So first of all, and make a phone here and call it F d g. Why this what would be used for the G y? So here it's like, telephoned I want and then closes. So now a couple of Egypt player and opponents draw Gee, why rent? And here I lad. So that's what you on the phone to after you. I know island. This function. We got a bit off the soil here and store it in this variable here. I'm going the first of image off the SPR going Sprite and the Whitman Astro X and drove I plus seven. These are the rebels we credit for drawing the lives here. And the seven is what works best for me for dust by exploration vertically so you might need a different value. And here I'm changing the horizontal alignment off the text to be drawn to write. And here I'm drawing. The coins were able at this position, and then I'm resetting the whole it alignment back to left digitally fold one. No, I don't know him. And you can see the amount of corns you collect up here. Now, if you want a tax to have a war in color, like the coin you need to create their own color. So, first of all on you to open the boys bright and click on the image and just like the color using the control key on the keyboard and then click here and you need to know down these RGB values so often ignored them down. Opened a video player and open that Giorgio event. And before the tax is being drawn, you need to add the scored. So here I am getting a corner using the RGB values I took from this right. And then I'm using gross that color to use this color for the text. And in the end, I So this is very certain that row color to white, which is not fold color for now all in the game and you can see that the left has a golden color. So there, this one for this lecture and I'll see you in the next one. 11. A10 - Audio: heavier and welcome to this lecture. This lecture I show you how you can add sounds to your game. So here I haven't watered three sold files. One is a back on music, one is attempting sowed and one is the going salt. So first of all, I'll implement the bag or music for that level of nuclear and open the creative end. And it'll I, lad, This is a song to play and this is the priority of the sound. There fairly doesn't matter. So I just sent this to 10. And this is what it does on loops or not. Since I want to sound to play after ends, I'll just and if the truth. So if I sent this to falls, it'll only play once. No wonder the condition here, so this music would only play if it's not all replaying. So if you re charmed again and the music is playing, it won't play for a second time. So now I learned the jumping sound for that Don't open the step event and here is a jump record and I was alone difficult. My colleague records and here I learned that sound good. So since I'm starting This too falls. The sound will only play months Now I'll open a coin object for the going sound inside this event here when the going of collective here I've read this old and no wonder in the game and you can hear the background music. No. If we jump, you can hear it up here jumping points here. So using this function and the right place, you can play any sound your board. So there is hope for this lecture and I'll see you in the next one. 12. B1 - Intro: Hey there. And welcome to this section in this section are well dug Importer, adding NBC's water inventory and much more so that start with the next lecture. 13. B2 - NPC Messages: Hey there. And in this lecture, I'll and MPT is to the game, the other than disease I'm going to add for the managers are using lives textbooks effort. This is my accent that you can buy for $2 When you can check out the resources off this lecture toe. Get appealing. When you open the feeling, you will see this page no before using, Guesthouse said, Make sure you logon on the you're against that side and then click on that gold and then click on every now open gamemaker. I make sure you are logged in. Nobody can marketplace and open my library. So this is remarkable. This library you could find. I said here, If we don't find it, you should we start the program. So for me it is an animal care, so don't order. And when it's done downloading, I'm really going on board. If you could add all on disliking board so no, there does. That has been imported. I started working on NBC's So Inside the Objects and make a group called NBC's and here make an object called G and B C. So this will be the bad object for old NPC objects. So first of all, other the temperament. And here I learned some cord. So this was hard time Ajax scale. So that we see faces a player. If they reject scale zero, it will be said toe one. No one in the droid went and they're discord here. Rossell is used to grow nine Stance This function message unending multi shows, um exist that are inside and every one by one. So this energy variable is going to be an area where I learned my manages. And this is the key There is used for speeding of that extra for moving to the next message . So here I'm using Enter, just called variant when the distance to the object player is less than 64 pictures. So Dad is when the message will be sure. And this function will stop the message when this condition is not true. No, I did a new ford for the managers, so I'll make it here and call it f d msg. I was like their phoned and give it a very small size. And here before discord, I let so this region the phone for the messages no occurred the fortune PC, I'll image Prodigy and PC zero. I said this right. I know by experience section and here drag and drop over the NBC to assign it as experiment . So all the events that are not inside the child object are taken from the parent object. So these step and drivers will be applied to this trial Object as well. No, inside this embassy object island, a creative mint. And here. So these are the images that receiving speak. You can add as many as you want. No, I'll open the room players on pc here and played a game. No, If you go near nine pc, you can see that the message is shown your best Enter a missing move to the next one but you can see that attack speed is very slow. To speed up the text, I'll open the scripts are inside dynamic Next a local a message and I make my script that be using and you can see the text speed here. This is a normal text speed and this is a speeding up text speed. So I jane gift to your 0.6 and if 21 I'll also opened up formed a genius. I've to six so nor for under game. You can see that Adex is faster. No, I could not secure NBC for that. I just don't look at this one and turn its name. And also junior Sprite. And in its great event, genius matter is no open the rule and players and busy here, another round again. So if you go closer, you can see dirty dogs. So notice one for this lecture and I'll see you in the next one. 14. B3 - Levels: Hey there. And in this lecture, I'll show you how you can add more levels into the game. First of all, inside objects, a little group called Game and we were below over. Nuclear here may call BJ next level, and you'll just right. The game moves the next level when the player that is the subject, so other the separate. And here that So if there's a collision with object layer and there is a room after the grand one, it will move to the next room. Also, I don't make this object. No open rooms. And Jane, this one's name toe R M level one on duplicate this. And in this level toe No, I look on this room and here are this This over your next level now will open the second level. And here, else like that shot us Leo here in this list as like the first instance, then move down to the last one and selected by holding shift and pressed late. So this would lead all last chances. No, I'll open it. I lyrics like this lacto and select all the tiles and Presley. And now Alberta level No look nice on this layer and place a player here an hour and looking. No, if you go to the end of the level, you can see that the game. Move to the next level. Noel. Implement the course. Spare tradition. For that, I'll make ob gyn men inside game. I'll make the subject of extent, so that is just even when the room is change. I don't like the intimate and hear a lot. Fareed Surf will be the surface that were stored by Major of the Grand Room to be used in the cross. Fade and fade out, probably with the opacity of the hospital. No other. The room indifferent and here a lot. When this rule ends, dislocated her face the size off the African surface and copy the application surface onto it. Then it will send afraid. Alpha Tau one no other. That road you haven't and here are that this court will only run if the faceoff surfaced as its if we accredited inside the room and event. If a DARPA excursion zero on the surface paid service will be drawn with yourself past year , said too afraid. Alpha and its scale said to master geoeye size, then afraid Alfa will be reduced for your 00.1. So the smallest value, the longer the gross paid. And if the Fed ALPA is none other than zero than the surface with diluted now open the first level and place aubergine men here and no order in the game. No, If you're in the level, you can see the crossword effect. And if you lose my falling, you're going to see that goes straight effect. Here is then. So that is all for this lecture, and I'll see you in the next one. 15. B4 - Debug Score: Hither and Malcolm Clueless Lecture in the Wheels lecture. We had more levels into the game, though you might have noticed something, or when you move to the next level, the lives and the score are reset. So in this lecture we'll find out why that happens and how to fix it. This basically happens because off this part, inside the object, players create event where the lives are said to tree and the coins are set to zero. When you go to a second level, do creative interns again, so the lives and the coins are, he said. So to fix this, I remove this court from here on open over Jemaine and here in the great moment. So there's a spare am initializing these variables, and here I am initializing the queen's variable as a global variable so that it can be used by other objects. The Subjects Period event will run only when the fourth level starts for the lives, and the coins won't reset when you enter another level. Also, I'll open items and open object going here and in its temperament here I removed the object player we fix because it's very able no longer belongs to a video player. I'll also open up a clear, open step event. Goto the Red State and here, where the rule is restarted. Are you said the lives Nowhere in the game protested? No. If you enter the second level, you can see that the coins and the lives are No, You said so. There is more for this lecture and I'll see you in the next one. 16. B5 - Water Tiles: header and Indus Lecture. We'll add more ties on water in the game. Adding worker terms to the game should be any of the test. You just need to add another title. Endure meant I said so inside my title said. I have added a little base year, so I'll open the first rule. It's learned this lier like this bridge from here and place it so now returned lugging. You can see that the bridge is working both 50. So this way you can add any tile into a main title, said Place it here on, the collisions will work. You can also add detail tiles that don't have an inclusions. So here I've created a new tiles that called TL detail, and here it has only offense for the bridge. So to play this I love in the room, and here I'll create a new Tyler and name it tiles underscored jail. And here a select that media lines that and here business ties, and you can see that it ain't guys here and they don't have any questions at all. So using the digital tiles, you can add more detail into the game. Now we learn the water dials. So here for the water, I have created a separate concept and it has only one water dying soil up in the room. And here, greater neutral set and name. It dies on the score. Water here's like that time set. And here there's a water. So I just leave this here and open up here and make it able to swim. So for us, I'll open the room start event and here I laughed. So this look at the title map from the water. Tyler inside the room. No look, no step event and Andy dope off the normal state here I laughed. This will store of a door, nor there's a border tile. Doubly exploration. No wonder some court after the gravity court. So when the beer is in the water, this will set the upper and lower limits for WSB variable. So I'm starting the lower limit to my spirit so that appear again. Job and I will limit to one. So when the players in the border on that, some gravity will be one you know, in this condition for jumping, I add brackets around this one and add recognition using the or operator so the player will be able to jump if it is on the ground or inside water. Here I have idle and we've exploited for those women. So now will implement these. I'll go to the animation part off the court and here before this condition I'll add an else because I'm going to add a recognition here so this could return if the player is in the water. So here, if there just is no Tikolo zero, which means simpler is moving. Then the sprite, we said to the moving Sprite and escape will be sent to the sign off HSP. If this is more to end up here, is jumping than again. The sprite would be settled about exploit if no, no, these are true and the spite would be sent to the artists. Right? So no one in the game and you can see the border here If people don't into it, he conceded, A player can swim and jump. So that is all for this lecture and I'll see you in the left one 17. B6 - Inventory: Hey, guys and Indus lecture, I'll be making the inventory. So first of all, I'll open up a gym in and open its great event, and here I create a list for that country. A lift is like an array, and it can store a load of values. So I have this list store member from a Nina. Never dealt what kind of item eight is now were not informed items. So these are the three kinds of items I'm making. A diamond, a cookie and a portion No, I create a global variable called item Know that restored the number of items there are. Since I've credit tree, I make it so No, I learned us right for these items in injury. So using different, we can know what's right is to be used for Malcolm type. Now we'll get an object for that item that can be collected by the player. So inside items make LBJ. I don't and just use just Damn, it's right. I understand different. And here, So I don't I really don't worry about that stores what kind of item distanced us is. So this court was like the great sprite for thy stones from Dari and oil. When the players coaches assist us, it's item type will be added to diameter list and by stance, will destroy. So that's where the pair can collect these items. No alerts on gravity. No wonder the creative ent and here agreed. I just mean I'm just happy went I lad. So when it s P is vertical to zero, it will be reduced by zero point Do multiplied by its sign so that it falls back to zero. And here it will be added to x no, open the room overnight. Start this year and place a light in here on the Berklee College slide creation core. And here I consulted side in time. So I'm stuck in this instance to be a diamond. No, I like the right time here the ugly cornet Immigration court and a concerned district cookie. And this way I can also add abortion. And now and again and you can see India. I don't here. And if it going here, you can touch and collect them. No, I make the enemy's randomly drop and item stolen open over the enemy zero. Open the temperament and go to a downstate and here. Where? This instances. Detroit. Before this dysfunction, I random one candidate on either zero or one. So here I am checking if it is equal to zero, so there's only a 50% chance there dis condition will be true. So this will store any random item, and this will create a budget item parents position. And this will said that items item type. So this random item and useful said it's at a speed to move away from the player. Now. Each time you run your game that I know values will be saying so make sure they are different in Eastern I'll open opportunity in and and the job of its creativity. I learned that end of my function and the order and loving. So if you kill naming it drops an item, and sometimes it doesn't. So these items you can let go into the inventory list, but you can't see them right now. So in the next chapter, I'll make these items available and usable 18. B7 - Inventory GUI: Hey there. And in this lecture, I make veggie y 14 country here in the G Y folder. I have been in stride for the items. It has a second self image to be used when we over our muscle weight. So entitled objects I'll make a GeoEye group and here I'll make objection and you'll just right. So what are you different? And here in a minute, speed equals zero so that the Sprite want any made. So now I close this on Goto, a pretty mean to Kourtney poor system. So let's go live in the game. It's postgame and tribal areas one, So I'll open the create event and here make a variable called Global Pose, and that just falls. So this will be available at retail. But in a game exposed or not, so now will add a new start event and here agreed earlier. So this little there were no buttons for the elementary will be created. I'm sending your steps to a very low value. So they're the bottles will appear on the top. So now we're just happened. And here I lad, this court is very simple. So let me explain it. Piece by piece. If the escapee express the pose, variable will be doubled. If the game is supposed, this condition will be true and the following Kourtney run. This will create an object called Over Your Dark, which all create later only. But earlier that object we grow our doctor klingle Ever go to screen, then W and that will be used as a horizontal and vertical locations For the wardens. Margin will be the distance between the edge of the screen and the edge of the Boston area . Science is the site of the Britten's and just if the distance between each button. Now this look will look through all the items Indian country and players departments. So underscore Exelon score by an operation here in this apartment is going to be very and Camp X and came by our the camera locations. So these values will be added on Dinos. Were that what we will be created inside the button? Leo. Then it's item. My day will be said toe I and it's item time will be set from the list so you can access item from a list like an array. But you have to you this access er before the i D. Then one would be a NATO w. So during the next bottom can be created to the right. But that was on location with the next button will be drawn, enters the right, merge in the level, Berry said, and actually decreased. So the capitals are placed in the next role and this part well done. If vases falls, which means the game has resumed, so this will destroy the buttons and over the dark, no inside to you. Why I create over your dog and add enjoyment. And here I allowed. So this will fill the room with the doctor tangled, no inevitably button. And at the control and Event and here this Newtonian sprite at the central doubled in. Make sure this fall scraggly gallows price origin should be under center. No wonder the separate. And here on our news, this will be true if the mouth is hovering over the border. So operatives imagine that's what they said to one. If the left most women expressed because I don't will be removed from the list, then Britain item type. Something will happen. So if it's a diamond, you'll get 10 coins with a cookie. You get one life, and with a portion you get to the nobody but on and off in the dark will be destroyed and the game will issue. And when the most is not holding over doubled er, imagine next will be sent to zero snow it or nothing and that had some white Does another address escape, and you can see the items here anonymously. Consult and you can see the effect If I click on Diamond like a 10 coins. If I click on a portion, I got two hearts, and if I click on a cookie, I got out. So this all working? Fine. But there's one problem. If you pause, you can see it in a game. Mr Running and Again, boss. So now I'll make the object Stop moving when the game is sport. So I looked up the Iplayer Step event and at the top I learned deals. So it because it's true this eventual exit and a very wonderful I know the same court inside over J and M A zero and the double this. Everyone I know sopa nobody NBC and Pledges Court and the top of the driver and now it how many balls you can see that enemies and a player stops. So that's all for this lecture and I see in the next one. 19. B8 - Pause Surface: Hey there! And in this lecture, I'll make the post surface. When you pose a game, you can see that the player and the enemy stop. But the animations don't and that then PC disappears. So in this lecture, I'll fix that. First of all, I'll go to a pretty dark and add a p argument and hear that. So there's no greater new Circle Star is a science off the infection surface and then copied. The implications are face inside the surface. So this will Katula game output when the game is posed. So now it open that drawer event. And here I remove these other functions because I know I want to draw and no packer tangle enough reduce that. So this will check in the whole surface at this or not. If it does, it will go the surface and the camera location and scale it or include us size I'm using see Great as a color so that the drones are based is darker. No, it'll destroy bit, which one spent on instances destroyed. And here, my lad, So if the ball surface as this, it will be destroyed an hour in the game and many balls. You can see that everything seems to stall there, and that's because of the bullets are officially made. So there's no record this lecture and I'll see you in the next one. 20. B9 - Boss: Hey there. And in this lecture, I'll make the enemy boss So you can see my both sprites here you can see in every boasts bright and this were scared where the bulls would be angry and we move faster. So a local nobody iplayer and go to the relevant and inside the stairs. You know, I add an angry chick, So now we'll make the boss. So for that, I'll open enemies and just duplicated this subject and in endeavours to over tables, I'll open it and Jane, despite until such unions mosque. And now we go to record event and genius. That's beautiful. No, a gross temperament. And after the whole state, I heard the angry Street. So now it changes right for each it. So I go down almost eight and Jen gives to SPR boss no, go to the heart state and to induce toe spr Both start on, go the any state and hear our land is and finally inside, the guy said. Now I'll go to the end of the heart, stared with that stare, stare into the MoMA state and Jane, just too angry so often up here is hard. Just admitted into the angry state in several normal one. And after this I learned this. So this region get sp So they're the boss move towards appear Now we're going to be a new state And here I learned this. So it if the boss will move and double speed now we go to a normal state on coping of all production and direction Gold another added years to the angry state And here with that just be a slipped genius Still stared set and, you know, straight to FB normal and do the same with the second condition. So one of both points of all or alleged the state between two enormous straight and angry state will end. So know that players that board inside a second room I learned industry in you can see the boss there When attacked, you go to young restate so you can refuted by dragging it four times. So there is all for this lecture and I'll see you in the next one 21. B10 - Lock: here, there. In this lecture, I make a log door that will open only when the boss is killed. First of all, a local objects and inside game, I'll make an object called or B J collision. So that's a bit apparent object for every object that is going to have a collision. So to court the collision, I look in the scripts, but all opened their style corporation. And here, after these two conditions, I'll add an or operator and add new tradition here. So this will check for a collision with the declaration was only and now will open time work, religion and here under this And this was a correlation vertically. So now I'll go do script. So here I have a Sprite with the law. I decided that animation for money opens, So I couldnt object inside game and name it over JLo and you'll just right inside a cage event. I live image speed because ago that the animation doesn't live on the start and only when the board is killed inside a step it meant I had this. Someone generation is done playing diet does will be destroyed. No open apartment off the subject and apply over a question here so that this object has brilliance. No, I'll open enemies and open over divorce. I go to a supplement and at the end, with the death studious before dietitians destroyed. I learned this. So this in turn, would you locate answers to any made for that The loco opens. So now appears the Lord's inside the room. So I don't again. And you can see that the look has operation and if you differently, balls the local opens. So there is a lot for this lecture and I will see you in the next one. 22. B11 - Boss Music: Hey there and in this lecture, either the boss music. So I want the most visit to play when the pair goes near the boss. But I don't just want to play instantly. I wanted to have a fair effect. So to do that I love in enemies and open up your bows and called a step event. I'll go to the end of the llama state, and here I like this. So that's going to be true if the player is close to the boss and the boss, music is not playing, so this will play in a both music, and this will take its volume 20 The you know here is the volume I want and there's zero in the time it takes to fade that volume. So 70 the volume will be applied instantly, and here I am, starting the volume toe one, but it will take 2000 will of seconds to do it. So that is two seconds, so it will have a fade effect and then the background music will fade out Now record the end of the both public, so I'll go to that state. And before the angels destroyed a lot of this. So this will fade out divorced music and this will fade in the background music and I wasn't looking in. So if you go near doubles, you can see the change is different. So the boss music ends. So there's a lot for this lecture, and I would say in the next one. 23. B12 - Game Menu: Hey there! And in this lecture, I make them in menu. Served in a new room for the menu Unlimited are mnu are dragged riddle soil open over Egypt Player for some reference, I would expect event where the cameras credit and I'll see the size that returned the height. So I said that size off the route the side of the camera here and I never abuse and made the brash one visible. I think it's you side with the same size and entered of you. Pore size according to the camera scale, which is two X So I multiply these values by two and also ill applied a bag owner made for the menu. Now inside game I create aubergine menu, so that's looking really many options. So inside it's great event that this rebel store, all the many options and when it's elected, is that all three of elected? And here I'm starting a phoned. No wonder the supplement and here I lead. If you create something, it's like very able by one. If don't expressed and reduce it by one if up expressed. This is a science off the menu items are a if the minutes literally Able regency and ordinary. It would be settled zero if it becomes world and zero, then Dominus elected. Very well will be sent to the end of Barry are produced on that So one Enter express. This will do something based on the minutes like it variable. So every day, zero we just play. Then the next door will open your 1st 1 which is quit. Then the game will end, losing their so you can perform any action when an option is selected. No, I don't Adroit Mint. And here other days. So this will look truly menu choices if our choices nor selected than its Alpha will be sent to Europe on seven. So only a choice start has been elected. We'll have a full fr. Then it will still be drawn. And then they are probably said to one. Now open them in your role and place this object over Gemma New here, another round again and you can see them. And he was working. And you can play the game and you can quit it. So that's all for this lecture, and I'll say in the next one 24. B14 - Story Intro: Heather and in this lecture on make the text intro for the game. First work in an object inside game and then we don't need a story. I learned of the event and here could ever able that was told dyinto text So this is a test for the intro. You can see that I have many strings and I'm adding them together using this plus sign. That's because you can't have one string on multiple lines, so you have to do it this way. And here this backslash and means a line break. So since I'm using to hear, this will add to line breaks. And now what are some more gold? This is a jet speed and this is a number of factors that are visible. And here I'm starting the bond and now and enjoyment. And here I learned this. This is the margin size and this is a maximum weight off the drone text here, child will be increased by text speed and this is a string that we contain only a number of factors that are defined by char. Then the string will be drawn using drawer next txt. This function has two extra arguments this one is on distrust between each line and this is the best one with off the text here for the distance between each line I'm using minus one so that you do this default value now low. So where does step event? And here I like so when and expressed this will proceed to the next room. Now open rooms and duplicate them in your room. I limb this r m story and I'm just below them on you. I'll open it and remove of Jim in your home here. I also remove the background and put a black color here a non put over your story here an hour on the bean and when you please, you can see the next year have a new press enter. You can skip this so there's a lot for this lecture and I'll see you in the actual 25. B15 - Save Load System: here and in this lecture I'll make a saving or to stone first of all, our implement of saving. I want to get to say, very closes so it's like or saving. So for that I love you mean and add a cleanup event. Disip endurance. Whenever there's an end to die, stance had withdrawn when the distance is destroyed or the room hands or the game ends. So here I learned this This will find or create if it doesn't exist. And I and I file this is the pile very well right are getting better. So this function will open the file so that we can write to it No other This in the United really is used to see in America Leonardo di and I pile. But this is a name of a section where we're saving a letter. This is the name of the gvr saving and this is a valuable ducky. So this will save a key with the name rule and you contain the grand room off the game. So this will save lives. And this was a quiet in the night. String is used to write text data. So this function delist right will convert the whole inventor leads to a strange so that you can receive. So that meant we will be saved in nine. I pile. So after that I would be closed because we no longer need to write in it. No, I really want the loading part. So first of all, I got an object inside game and name it over JLo on a good position. The subject will simply kinda low data into a level. Now open up the menu and in its credit mint here, all of this. So if the saved Udayana pilings, it's which means there is some save better. Ah, continue. Option will be added to the menu for chained up the option to new game so they will start a new game and this will load the game from the safe file. So I'll open it step event. And here are the case to for its continued option and the week. And here are the Lord in court. After opening by and I file it repaired over your Lord dysfunctions can be used to going to see a better come down and I file using any read real. I can continue Miracle that assailed. So here I am, getting us a room, lives coins and then hundreds stream and then storing them in local laborers. These are the fourth will used to load in care. Same data is not found. Then I'm changing the room to the state rule and then moving these variables to the official or in terms we just created and then tiny partly because so the salary saved at a book with a safe room and pass the savory Ables to obey the Lord. No, I'll apply the same get out of the game. So I love one of the main and they appear different after these very most Thailand is. So if LBJ load exists when nobody minutes created, which means that the game was loaded than the lives coils and the country will be set from that instance and that it starts, we destroy it. Dysfunction. Yes, list We'd we can afford a string into the inventory. No, finally I'll goto over the Lord and parent. The room start event. Here are this. So you know that were placed over You mean only inside the post level and Nord arrest, because that object is persistent. So in case the game laws into the second level or any other. And over the main doesn't exist here. It will be created no one in the game place, Um and then close it in. Order it again. And here you can see the continue option. I'll open it and you can see that everything has been restored, even inventory. So this way you can say anything to win a pile and then, Lord later. So therefore for this lecture and I'll see you in the next one. 26. B16 - Parallax Backgrounds: Hey there. In this lecture of implement Parallax backgrounds, Barrel s gives a sense of depth in the backgrounds by moving them a different speech. So this is a game without paradox. You can see how the back on the stairs verities and this is a game with parallax. You can see how the buildings are moving faster and the clouds and the tiles are moving faster and the buildings. So here I've imported the background sprites. One is velocity and the other is the sky. Their heart should be the same as a room height. So their defeat, their words can be anything because I'll escape repeating soil open. Or did you mean and opening soon started went. This is where we'll set of the background layers where the room starts. So here and at this, let's focus on this part. First, this line will create a layer for the city background. With that step to being 1000 so desperate will appear below the layers, definitely to create a background elements in that layer. So dysfunction will do that during its value in a local very able, then that background elements for total dialing we was had to true so that I may be Ph would. Only then this part will do the same. But for the sky background, it step will be 2000 so it will appear below the city. Leah now will open its supplement and here alert this dysfunction ingeniously horizontal position. Open air for the 30 backgrounds. Explanation. I'm taking the cameras explosion and dividing it by four for the sky. Back on position. I'm dividing the camera position by two background started closer to the camera. Need to move faster, so we're taking the camera position and dividing it by two forest kyliyah. But we're dividing it by four for the failure. Such will appear to move faster away from the camera because it's closer. Not a final thing you need to do is open the room on disabled better earlier. I'll do the same for the other room an hour on the game, and you can see the background end up. I'll expect so now let's move to the next lecture