Godot Game Development for Beginners

freeCodeCamp.org · Beginner ·🌐 Frontend Engineering ·10mo ago

Key Takeaways

This video teaches game development using the Godot Game Engine, covering topics such as setting up the engine, creating levels, designing tile sets, and adding player characters, checkpoints, scoring, and enemies. The video uses tools like Godot, GDScript, and Node 2D to demonstrate game development concepts.

Full Transcript

This course will guide you step by step through building your very own first game using the GooDo game engine. You'll start by setting up GDO and getting comfortable with the editor. From there, you'll create levels, design tile sets, and add a player character. The lessons also cover checkpoints, scoring, and adding enemies to make the game more engaging. Each concept is introduced in a simple and approachable way, perfect for beginners. By the end, you'll have a complete playable game that you can customize and expand further. This course was developed by Sarah and Ree. They are both students who are part of Hack Club. Hack Club is a global nonprofit organization that creates a community for high school students interested in coding and making things with technology. >> Ever wanted to make your own game, but didn't know how? >> In this tutorial, you learn how to make your own game with the GDO game engine. I'm Sarah and I'm a 16-year-old hack clubber from California. >> And I'm Ree, a 17-year-old hack clubber from New York. >> Let's get started. >> For those of you who don't know, Gadell is a free open-source game engine that helps you build 2D and 3D games. So, the first part of building with GDAL is downloading the Gadell engine. So, head to gadell engine.org and just download the latest version. I already have it installed uh for time sake. So after you finish your install, you should be able to find a dotzip folder. So you want to extract this and this should take you to a new folder with your two exe files. So run the first one and this will take you to the GDO project manager where you can create your first game. So I'm going to create a new game. I'll just call it GDO game one or maybe GDO game demo. And this is going to run and take you to the GDAU engine where you can start building your game. And now is going to show you how to build tile sets in your first game. Head over to this repository to get the art that we'll be using for your game. Click on code local and download as zip to download the art files that you'll be using on your tile set. Once that's downloaded, unzip the file. Head back over to your GDO project and click on the file manager. Right click and click on open in file manager. And take the file that you just unzipped and drag it into either the editor or your file manager for your game. Great. That file should now appear in your editor. Let's get started on your game. Create a new 2D scene. Click the add button to add a child node. Add tile map layer and then open tile map at the bottom of your screen. This is where we'll be importing our tile set for your date. If you look at the inspector, your tile set currently says empty. Let's change that. On the down button next to empty, click on new tile set. You should have a new button that pops up on your bottom of your screen saying tile set. Click on the add button. Add an atlas. Open your GDO folder and open the art folder. We'll be using this Aurora tile set PNG file for the background of our game. Click open and this Atlas texture will automatically modified by the GDAU editor. Currently, our tiles are a little too small. Let's open up tile set tile size and change it to 32x 32 pixels. to increase the size of our tiles. However, how do we actually get the tile set from here onto the background of our game? This is where the tile set comes in handy. Let's change the texture region to 32x 32 by modifying the tile map layer in the inspector. This will allow your player to actually interact with the tiles that we add. To make some tiles solid, we're going to assign them physics layers. Head over to your tile map layer inspector and click on physics layers. Add an element. Add a new physics material. And then in the drop- down menu of your select page on tile set, you'll see a new physics tab pop up. Click on it. Click on it again and then press F on your keyboard. When it's shaded in red, you'll know that your tile has officially become a solid. I could individually go and press F on each and every single one of these tiles, but that'll take a lot of work, especially as we move into larger and larger tile sets. So to select multiple tiles, I'll hold shift and drag my mouse over all of the tiles that we currently have. I'll click on F. And now when I click on each and every single one of them, they've each become individual solid tiles that the player can officially interact with. So we've created our tiles and if we go to tile map and we go to draw, we can see that we are able to draw with them and they look great. But one thing that you'll quickly notice is that if I just want to create a basic shape, I have to keep going back and keep selecting the tiles. And this can get really tedious really quickly. So let's fix this. So let's go to our terrain sets, add element, and under trains again, add element. And this will create a new terrain called train zero. Let's go back to our tile sets, go to paint, and go to terrain. So, we're going to select train set zero and again train zero. And we're just going to be able to draw on this. So, if you double click on this, you can see that this allows you to draw. And for each tile, you're going to create you're going to draw on them and you're going to create a grid-like pattern that looks like this where it's like two it's like a bunch of squares inside of each other. So, yeah, this is our train. And when we go to our tile map and go to terrains, we'll see the terrain set zero. And now we can see that when we draw, it'll just fill it in for itself. So this makes building our game way easier. And when we run it, oh, first let's select our main scene. So first of all, you want to save this as your main scene. And you want to rename this no 2D name. And when we try to run our game, it'll ask us to select a main scene. So, we'll just select current. And yeah, you can see our tiles. But one thing you'll notice pretty quickly is we don't have a player. So, let's get on that. So, let's create a new node. And we'll make a tile map layer. Oh, sorry, not a tile map layer. We're going to create a character 2D. So, let's name this player. Let's create a area 2D. Under that, we'll create a collision shape 2D. Under collision shape. We're going to make a rectangle. There you go. Um, let's drag in our icon SVG. We can replace this with art later. So, let's make sure that our icon is a child of player and not area 2D. Um, yeah. So, let's attach our script to our player. So, generally this has template code, but it looks like it doesn't. So, let me go grab that. Okay, cool. So, this is the template code. You should have this in your repository. Not sure why it wasn't there, but if we save this as player.cc scene and we go back to our main in the 2D viewer. And let's import our player. Start it wherever you want. Maybe down here. And we run our game. Oh, we can see that our player fell through. So, let's see why. Oh, yeah. So, you can see that our player does not have a shape. Oh, okay. So, we're just going to add a collision shape 2D to D and no area 2D. My bad. So, when we save this and run our game again, our player should be able to interact with our tile sets. And one thing you can see is that the player isn't moving. So, to solve this, let's go to our project and project settings and we have to make an input map. So, this is basically telling the computer what we want um our input keys to be. So, I would like to use WD. So, under UI left, I'm just going to type in A, and it's going to listen for that input I added. Under right, I'm going to add D. We don't. For up, I'm just going to use space. And we don't need it down. So, let's go back to our game. And you can see our character moves. And that is great. But one thing you might notice is the camera's in kind of an awkward position. So, let's add a new camera node under our player. And we're going to attach a script. And again, they should have template code, but it's not there. And we want this to follow our player. So, we're going to declare a variable at on ready for player is equal to, let's just drag this in our player. And we don't need the ready function. So, for our process function, again, this just runs every frame. So, we're going to say our global position, which refers to the global position of our camera, is equal to our player. global position. So, when we run this, you can see that our camera now follows the player, which is great. Um, one thing you might notice is that maybe you want to adjust the player um height. So, to do that, sorry, not player height, the player movement, like how fast it moves, how high it jumps. So, if I want to jump, if I want this to jump higher, just increase this number and rerun our game. Oopsie. Wait, I'm really bad at this. Um, yeah, you can see that our player will jump higher. But anyways, um, this is great. This can show you what our next issue is. So, we do have a game and our player can jump around, but our player can also just like fall into the abyss and nothing will happen. So, we have to create a checkpoint and death system so that when the player falls, they'll die and the game can move on and we can keep going. So, first things first, let's create a let's create a new node in our main scene and we're going to make it node 2D. and we're just going to name this checkpoint manager. Let's attach a new script to it. Variable mass location. And again, we're going to declare our variable player is equal to player. So, let's add a new function. This is the built-in function. um checking this is the built-in GDAU function that runs the first time your game loads up. So when this is ready, we're going to say our last location is equal to our player global position. So yeah, this is our checkpoint manager. And now let's create a new node. We're going to create a area 2D Um, under this, let's add a collision shape 2D, a marker 2D, and let's rename our arrow 2D checkpoint. And let's create a shape for our collision shape. I'm just going to make this a rectangle. And let's drag our marker 2D over here to the right. So, let's attach a new script to our checkpoint. And we're going to declare our variable checkpoint manager. And we're going to take our ready function. And when this runs, we're going to say checkpoint manager is equal to get parent.get parent get node checkpoint manager. Cool. And then we're going to say so for our yeah for our area 2D we're going to go to our node and this is a signal and this is just code that will run when an event is triggered. So click on body entered and attach that signal to our checkpoint and you'll see a new function appeared called on body entered. So when body is entered, we're going to say um first of all we're going to check if the body is equal to our player. So we're going to say body.name is equal to player. And if that true if that is true then that means our player passed through our checkpoint. So, we're going to say in our checkpoint manager, our checkpoint manager thought last location is equal to our global position. We're going to say checkpoint manager dot last location is equal to our record global position. So this is our checkpoint script and we're just going to save it as checkpoint scene. And now for our death zone. So let's create another area 2D and a collision shape 2D. And that's it. So let's go over to our 2D viewer and let's just make a rectangle. Let's rename this death zone. Add a script. So uh when our area 2D is entered we want to add a signal. So select this add a body entered and that's our function. Um we also have to declare our variables. So, we're say for our player um for our checkpoint manager. So again for our ready function we're going to say our player is equal to get parent get parent load player. We're going to say checkpoint manager. Oopsies. Parents get node checkpoint manager. So yeah, this is us declaring our variables and this is what's actually going to run. So again, we need to check if the body that passed through if its name is equal to player and if so, we want to kill player. So right now I'm just going to put pass but let's create a new function called kill player. And what we want this to do is we want to set our player's global position. So player global position is equal to checkpoint manager last location. And we're going to call this in our body entered and it should get our player. So let's test it. So, first of all, you need to save your death zone script and then go back to your main scene and let's just import our oopsies, I didn't name it. Yeah. So, you need to save your scene and then link it in your add in a checkpoint checkpoint. So, this is our checkpoint. So, tile set and add a scene collection. And we're just going to drag our desk some in here. And if you go to tile map and go up to tiles, you should be able to draw with your that scene. And it is a little weird shape, but we can fix that in a second. So, let's just test this. And yeah, you can see that when you go over here, it'll kill you. So, let's fix our shape. You can see that's a little bit not the correct size. That looks about right. And yeah, when we fall over there, that'll kill us. Let's go through our checkpoint. And we go over there, that'll kill us. So yeah, we have our death zones and checkpoint set up. And our death zones are also really easy to reuse because we just go to our tile maps and start drawing with them. So now is going to show you how to make obstacles. A >> new scene. Add a static body 2D to as the root node. A collision shape so that your character can interact with the obstacle. Define your collision shape. For me, I want my collision shape to be the same size as my sign. So I'm going to add a circular collision shape. I'll drag this down here and I'll increase the size like I want. To import the sun's texture into the scene, I'll add another child node named sprite 2D. And then I'll load in the texture as my sun png. Then I'll adjust the size of this collision shape to fit the size of the sun. Rename this to say obstacle and click hit control S or command S to save this as an obstacle scene. Import my obstacle to the main scene as a child node. and I'll drag it where I want the player to have an obstacle against. Now, when I play the scene, my character cannot go past the obstacle. One immediate thing about a game is that it's kind of ugly. So, let's make it pretty. So, let's start off by adding a background. So, let's create a new node. And we're going to make a par what's called sketch parallax parallax background. My bad. Um, and we're going to add a parax 2D. No, no, we're going to add the parallaxing layer. Okay, cool. So, in our note 2D, let's go to our motion. Uh, we're just going to set it to 1,600 by 900 because that's the size of the art I made. So, we're going to go to our art and we're going to drag in background. There's our background. So, let's drag it into our scene. And as you can see, he's a little big. So, let's just align him. I guess align her um with the top and align it with that purple rectangle you see because that's how our screen's going to loop. So this is our background and we have to make a child parallax. Make it a child of parallax layer. And you can see that it's looping and it was actually the correct pier. So let me just like align that. So, let's save this as background and our main scene and import it. And you can move it around wherever you want. I would prefer it to be a little higher up. So, um Oops. You can't do that. Um I'm just going to look this whole thing up. So, when we run our game, you can see we have a background and it's moving. And seriously, I just killed myself. Um, okay. So, let's expand our tile map layer. So, first of all, we want to draw more with it. Uh, because right now our death zone is very limited. So, let's like draw over here. It's like whole way, I guess. And let's include more of our tiles so that we have, you know, more gameplay. So, I'm just going to put some over here. You can put them wherever you want. This is just like, you know, sample. There you go. Great. So, let's run our game again. And jump. And you can see our background. And you can see that it's continuing. Um, so yeah, now we have a looping background. You might want to move it up a little more just like so it fits the frame of your game. Kind of like this. I think this is great. Um but yeah that's our background. Next thing so next thing to do is let's add player animation. So let's add under our player node a animation player and a animated sprite. So under animation we're going to add a new sprite frame. And let me go to our animation bar under Yeah, under sprite frames, we have this new menu. So over here, let's sprite sheet and we're going to be using this art folder I made. And let's just add in the idle animation first. So you can see that it's split up kind of weird. So these um sprites are 32x 32. So set them like that and then select them. And we're going to add two frames. And this is our default. So, save this. And let's also get rid of this good icon because it's not very cute. Uh, one thing you might notice is that the bar is a little blurry. So, under texture, you want to make it nearest, and that'll make it clear again. Where is that? Autoplay autoload. So, let's reload our game. And you can see he's bouncing. He's very cute, but he's not like moving or anything. So, let's fix that. So, under sprite frames, let's add in our run.png. So, again, you want to import the art from sprite sheet. Um, the tile size is correct now. So, we can just add it like this. And we have to create a new animation. Just call it run again. spice it and these are our two animations but they will not run without adding a code. So let's go there. So over here in our process let's yeah so if there's direction which would be if we have an input we want to play our animation. So first thing we have to declare our animation layer. So say I've already animation player this guy and then I'll say animation player play button. So let's see. Oops. You also have to I think this should be good. um say bar animated sprite oopsies is equal to animated sprite 2 and if there's direction which basically means if there's an x or y input um we're going to animation right play run so let's run And you can see when we're running, he's running. Uh, but we can also see he keeps running. So if there's else, we're going to say run our idle or default. So let's try that. And yeah, you can see when he's not running, he's not, you know, running. And when he's running, he's running. So that's great. But what happens when you go left? He's still facing forward. So let's change. So, we're just going to add one more line sprite play. So, let's just add one more line. We say animated sprite flip um flip horizontally if direction. Let's fix that. So, animated sprite flip horizontal is equal to direction. So, let's run this. And great, you can see that they're changing their direction based off of where you're running and if you're actually running. So that's super cute. Super cool. No more stuff. So right now, iron game is pretty cute and you can jump around, but there's nothing that really makes it a game. There's no enemies and there's no like real movement. So next thing is we want to add moving platforms and enemies. So let's just start off with moving platforms. So let's create a new node and we'll make a path 2D. Under it, we're going to create path follow 2D. Under that we're going to add a remote transform to the going to add animatable animable animatable body and add animatable body 2D. Under that collision shape 2D and over here we're going to add in our art. It's just called platformer. Very original. Add a animation layer. There you go. So, first thing, let's add a shape. So, just make it fit your platformer. Again, you want to change the texture so that's clear, not blurry. Um, under remote transform 2D, we're going to assign it animatable body to 2D. Um, yeah. So under our path 2D, let's create let's add element under points. Let's add another element. And we're just going to that oopsies. Just going to move that around. And this is just changing where our this is just creating our path. Um it's a little jank, but yeah. So this is just going to move it that way. Uh, let me add our platformer back. One thing that I like to do is under resource, I like to say local to scene because if you don't do that, then it's going to change all of the paths when you edit one path and while you're building your game, that can get really annoying. But yeah, that's our path followd. Uh, under our animation player. So, under our animation player, we're going to create an animation. But um I'll just name it like movement I guess. So let's add a don't add a track. Go to your path follow to date and under progress ratio let's make a key frame. So this is just tracking the progress of our platformer along this path. And we have a key frame right now at this current position. If we go to our path follow, yeah, let's just like move our progress ratio over to one. And we're going to add a new and move our time over here. Uh change our progress ratio and add a key frame. So when you run this, you can see our platform moving, which is super cool. But it's um just staying there. So over here, let's add a bounce back. Just click clicking and this should yeah bounce between it. So let's run our animation again. And yeah, super cool. Um so let's save this as moving platform and um yeah so in our main node let's name platform. Where is it? Oh oops it's over here. Oh my bad. Um before you export let's name this the link platform. Save link it. There you go. So, it's over here. And our game, you should be able to see it move. Oh, or not. Well, you can see our collection body works, but you can also see it's not automatically running. So, why is that? Okay. So, under platform, let's add a script. There you go. Uh function ready. It's for a bit bump. Um yeah. So first we have to say for ready for animation is equal to animation player. And when our game loads up we can do animation play movements. So let's save this. Let's go to our main mode. Um, I already imported it, but yeah, just do that. And yeah, now when you're in your main mode, you can see different platforms, which is pretty cool. So, next thing is enemies so that your player can actually interact with things instead of just like jumping around. Okay. Um, my laptop might have just died, but anyways, let's create a enemy. So, um, going over here, let's create and then let's create a character body 2D. Let's create a collision shape. Create a area 2D, a collision shape. And in our 2D viewer, we're going to drag in our enemy.png. Again, we're going to make him not blurry because blurry is not good. Um, oh yeah, we're also going to link our death cell. So, yeah, just align that with your character. There you go. For our collision shape, you want to make sure that it's a little smaller than the death zone, otherwise our player won't be able to interact with it. So, let's make that uh for our collision shape to D. We're going to add a circle this time. And what this is is this is just like the enemy's vision zone, which is pretty cool. And basically what we want this to do is if the player enters that vision zone, then our enemy will follow them. So, let's save this as enemy.t. And really quickly, we're just going to import it so we can test the deathiness of our enemy. So, what I'm looking for right now is that when we go to our player, they'll die. And you see they're dying. That's like great. Anyways, uh let's add in some movement for our enemy. So, first of all, let's name this enemy and let's attach a new script. So the three functions we need our function physics process which is the built-in fiddle process. I'm going to make it just put a pass in there because I don't need it right now. And for our area 2D, we're going to go to our node and we're going to add a body entered signal and a body exited signal. So again, these just run whenever anything enters our area 2D. And we don't really want anything to make the enemy start chasing after the player. So we have to check if the body is if the body name is equal to player. So let's add a pass here. Um next thing is we need to add our speed variable. So I'll just say speed is equal to like 200. Uh again we have to declare our player. So my default player is equal to player. There you go. So if and last variable we have to add is a bar follow. So this is just going to be a boolean and whenever the player enters that boolean will be true and whenever the player leaves that boolean will be false. And depending on the value of that boolean we're going to be you know chasing the player. So if the player enters the scene we say follow is equal to true and if it's not say follow is equal false and in our physics process um first thing you have to do is uh you have to add a move and slide function this is just how good actually like runs the physics so just make sure you have that um v follow if follow. So basically if our player is to the left of our enemy we want our enemy to go left. For players to the right to our of our enemy want our enemy to go right. So the way we do this is by looking at the x coordinates. So if the players x coordinates are more negative or less than our enemy coordinates then our enemy will go left. And if player coordinates players x coordinates are more to the right then our enemy will go right. So let's implement that. So if follow um we add another if statement. If player do global position dox is less than global position.x that means our player is to left. So we're going to say velocity.x is equal to negative speed. And then else if player.global position dox is greater than global position.x then we say our velocity.xe velocity x is equal to speed. And I spelled velocity wrong because I'm silly. So yeah, let's try that. Okay, cool. So you can see our enemy's following our player. Cool. But one thing you can see is that our enemy is floating. So what we want to do is add another if statement. Uh if not is on floor velocity less equal gravity. Gravity alpha. I think that should work. Let's try it. Oh get gravity. Okay, let's try that. Okay, cool. You see our play getting like hunted down by by our enemy. It's actually kind of annoying, but yeah, that's what an enemy is for. Um, you can lower the speed if you want, like if you're bad at video games like me, and they'll chase you slower and you can actually run away. So, yeah, now we have an enemy. So, um, I want to create a scoring system. So the way we're going to do that is we're going to create a new node. We're going to create a canvas layer. Under that we're going to add two labels. So the first one is going to be score. The second one is going to be time. And in our text we're going to say time blank. Same thing for score. And let's name our canvas HD. And then for our score, um, for our labels, we can actually select where they sit on the screen. So for our score, I want it to be to the right. And for our time, I want it to be to the to the top. So let's add a new script here. And I already have old code in here, but we're going to write it, so don't worry. So um, four variables we have. So we have bar time is equal to zero. Bar score is equal to zero. Bar um on ready or time label is equal to time at on ready or score label is equal to score and So for our process, we basically want to be updating our time and label all the time. So I'm going to put a pass here. And then I'm going to create two new functions called show time or update time pass uh funk update score pass. So for our score um we'll just say score label dot text is equal to score colon comma plus uh string score. So this is just taking our score variable and turning it to a string and um making this entire string and sending it to our text. And for update time, we're going to have essentially the same thing uh except for unit time. Uh one thing we want to do is we have to actually update the time. So we say time is equal to time.get time.get get six millisecond 500. Um, oh, oopsies. I have to like save this h. And yeah, we have to link it into our scene. And when we run this, we see that it's blank. Yeah, that's because I'm not actually updating it in functions. So I just put update time and then update score and let's yeah you can see our time going up and you can see our score increasing. Thing is our score isn't actually updating. So one way we can increase our player score is adding collectibles. So, let's create a um node. We're going to make this a static body 2D and a collision shape. Um oh, wait. Actually, we're going to make an area to a collision shape. And in our node editor, um I'm just going to use this mode.png. Uh, set the texture to nearest collision shape. Um, add a rectangle and get the moon in there. Let's name this collectible and add a script to it. So in our tactical we need to add a um body entered signal. So we'll add that over here. And again um we want to check if the body name equal to player. And if so then we want to one increase the score and two um get rid of the object. So let's say for player um funk on ready. Oh I think it's called ready. Um function ready. Um player is equal to get uh let me try that. So if body name is equal to player then oh we actually don't need play. So save HD to go. So if body name is equal to player then we increase our score. So HD dots score plus equal like 50 I guess. So last other thing is to get rid of our art. So, we can do this by doing key frame. And let's see. Let's save this as collectible. Import it to our main scene. I'm just going to put it over here. There we go. And yeah, you can see our collectible disappears and our score increases. So that is very cool. So last thing that I want to do to really take this to the next level is add in levels only. Um you can see that it's kind of just one scene, but adding levels can let you yeah have more levels and make a buildable game. And it's just really cool. And this will require a little bit of restructuring. It's not that bad. So don't worry. Um, first thing I would like to do is in our folder, let's create a new folder with levels. So, in our levels, we're going to create two new scenes. We're just going to create level level one um level one and level two. Um, generally when you have video games that go to the next level, you have some sort of icon that leads you there. So, it could be like a door or like the flag pole in Mario. Um, I don't think I made any more art. So, it would be very cool challenge for you guys to make your own art and um, design your own door. But for right now, I'm just going to reuse this PNG. So, let's create a new scene. Create an area 2D. Okay. Collision shape 3D. Uh, and now we're going to drag in our sun. Again, change the texture to nearest shape 2D. Add in a rectangle. And we just want to match that to our shape. So, let's name this next level. And we'll add in a script. And all we have to do here is we have to add a body entered signal. And if body name is equal to player, then we're going to say that um I'm going to create a new variable. Our current scene file is equal to get get tree.get [Music] current get current scene scene file path. Um so this is going to return our file path. So if you want you can I print this and save it and import it into main uh next level. Yeah, that's going to print our current scene. So, let's rename our main level one and let's drag it into levels. So, let's run that again. And um one thing is now that that is not our main scene, we have to run um our current scene. So, uh, we're going have to create a new level one. And um, let's open it. Uh, it's over here. Let's open that. And we're just going to have to import our, um, stuff again. It's not a big deal. Um, so import player. Import um, here. One thing that we do want to do is we want to move our tile sets into a new scene. So, we're going to name a tile map layer. And we're basically just going to do what we did in the new scene. It's not a big deal. So, uh if you remember what we're going to do is create a new new tile set and go into our tile set. We're going to add in a new atlas. Use a roar tile set. Um automatically create textures. change the tile sizing in both this menu and um this menu. Let's create physics layers. Let's create a terrain set. And um let's select all of them. Add a physics layer. Uh go to paint. Add a terrain. [Music] Draw in your terrain. Um, let's import our scenes collection. And we're going to import our death scene. What is that? That's sum. And yeah, we can draw with it again. It's not a big deal. So, I'm just going to save this as tile map. And going back to our level one, we're going to import our tile map. Uh do a little drawing, I guess. Um I'm just going to save that. So, we also have to import a next level. So, I'm going to drag it over here. Uh move it around. Let's also import our HD. And yeah, that's basically all you need for each level. So, you can just copy this over into level two. So, make your player, make your 2P, and make a tile map, and just draw like a little so your player won't like fall immediately into the void. So, um just save this. And then going back to our next level. Let's go to our script. So if we run our level one, uh we see this and we go over here, it'll print our current file path. So that's great. Um but we have to be able to increase the um digit over here to get to the next scene. So what we're going to do is we're going to say v number is equal um current scene file. two int plus one and you can print that just you know for debugging purposes uh current scene scene file path. So try that again. Okay. So we can see that our number is at two. So then I'm going to say r um next c is equal to um I can't I don't remember. Let me frame it. So uh print current scene file. Okay. So we want our next file to be at here last number plustc and then change to it. So get tree get next um change to file next scene. Oh yeah. So you have to uh make this a string. So you say to string you have to wrap it in parenthesis and apply the stream function. And when we hop over there, we're going to we're going to go to our next level. So yeah, you just created your own game in GDU and it has really cool art, really cool characters, and level switching, which is really awesome. But yeah, everything in here is pretty modular, but this is a really cool base to scale things off of. And right now, I'm going to show you how to deploy your game so everyone can see it. Okay. So, if we want to export our game onto it.io, which is basically a free game platform, um just follow these steps, I guess. So, go to editor, go to manage export templates, and uh let me look. Oh, I think my Wi-Fi is really bad. Uh let's download and install. And this will take a hot minute. Okay. So, export this. Export your project and index.html. Um, highlight all these, send them to a zip. Does not matter what your zip is called. And go to your it homepage. Oopsies. Click on this arrow. Upload a new project. Gell name it name it however you want. Um make sure that the kind of project is HTML and then upload your zip file zip zip file. Um this can take a minute but it's not a big deal. One thing to know is that if you want your project to be public after um you first post it, you have to go back and edit it and make it public. Uh right now it's private. Uh there's nothing wrong with your computer. That's just how it works. Uh this takes a second to upload because your game fits pretty big. Uh got this file will be played in browser and save page and you're good to go. will boot up and yeah now your game is um on the internet and other people can play and core functionalities are still there. Um so yeah that's where I'll be ending this tutorial. Um, in part one and part two, you created your own tile sets, your own character, um, death zones and obstacles. In part two, we added a lot of art to make it prettier. So, we added our own backgrounds. We added character animations. Um, we added this really cool um, display of your points and a bunch of extra functionalities like enemies, levels. So yeah, you now have a really good base to build your own game and I'd love to see what you guys build. So let me know in the comments and DM me on the clip if you need any help or just comment and I'll try to respond. So yeah, cool. Bye.

Original Description

Learn how to develop games using the Godot Game Engine. You’ll start by setting up Godot and getting comfortable with the editor. From there, you’ll create levels, design tile sets, and add a player character. The lessons also cover checkpoints, scoring, and adding enemies to make the game more engaging. By the end, you’ll have a complete, playable game that you can customize and expand further. This course was developed by Sarah and Reem. They are both students who are part of Hack Club. Hack Club is a global non-profit organization that creates a community for high school students interested in coding and making things with technology. Hack Club is free and any teenager can join. Check out their site to get stickers and learn more: https://hackclub.com/ ❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp ⭐️ Contents ⭐️ - 00:00 Intro - 01:03 Getting Started: Installing Godot - 02:07 Setting Up Your Project & Art Files - 03:17 Building the World: Tile Maps & Tile Sets - 05:08 Adding Physics to Tiles - 06:29 Creating Terrains for Easy Level Design - 07:54 Creating the Player Character - 09:46 Setting Up Player Input (Controls) - 10:22 Adding a Camera That Follows the Player - 11:52 Game Mechanics: Checkpoints & Death System - 19:07 Adding Obstacles - 20:42 Designing the Environment: Backgrounds & Moving Platforms - 23:42 Bringing the Player to Life: Character Animations - 33:39 Adding a Challenge: Creating Enemies - 39:28 Making It a Game: Scoring System & HUD - 42:57 Creating Collectibles - 45:55 Level Progression: Switching Between Scenes - 54:50 Sharing Your Creation: How to Export & Deploy Your Game - 57:02 Conclusion 🎉 Thanks to our Champion and Sponsor supporters: 👾 Drake Milly 👾 Ulises Moralez 👾 Goddard Tan 👾 David MG 👾 Matthew Springman 👾 Claudio 👾 Oscar R. 👾 jedi-or-sith 👾 Nattira Maneerat 👾 Justin Hual -- Learn to code for free and get
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60

← Previous Next →
1 React: Production Server Setup Part 2 - Live Coding with Jesse
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
2 cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
3 Browser history tutorial - Beau teaches JavaScript
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
4 Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
5 React: Parameterized Routing with Next.js - Live Coding with Jesse
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
6 React: Dealing with jQuery Issues - Live Coding with Jesse
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
7 setInterval and setTimeout: timing events - Beau teaches JavaScript
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
8 Browser and Device Testing - Live Coding with Jesse
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
9 Last Minute Updates - Live Coding with Jesse
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
10 Post Launch Updates - Live Coding with Jesse
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
11 React: Setting Up Google Analytics - Live Coding with Jesse
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
12 React: Masonry Layout - Live Coding with Jesse
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
13 Load Balancing Digital Ocean Droplets - Live Coding with Jesse
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
14 try, catch, finally, throw - error handling in JavaScript
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
15 Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
16 Graphs: breadth-first search - Beau teaches JavaScript
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
17 React: Masonry Layout Part 2 - Live Coding with Jesse
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
18 React: WordPress API Live Search - Live Coding with Jesse
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
19 Creating WordPress Custom Post Types - Live Coding With Jesse
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
20 Dates - Beau teaches JavaScript
Dates - Beau teaches JavaScript
freeCodeCamp.org
21 Miscellaneous Front End Updates - Live Coding with Jesse
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
22 Merging a Pull Request from GitHub - Live Coding with Jesse
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
23 React + Prettier + Standard JS - Live Coding with Jesse
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
24 React: Sortable Responsive Table - Live Coding with Jesse
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
25 Geolocation Sorting by Distance - Live Coding with Jesse
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
26 Tradeoff Matrix - Agile Software Development
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
27 The Definition of Ready - Agile Software Development
The Definition of Ready - Agile Software Development
freeCodeCamp.org
28 Getting first React job without experience - Ask Preethi
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
29 React: Google Analytics Click Tracking - Live Coding with Jesse
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
30 Submitting a PR to an Open Source Project - Live Coding with Jesse
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
31 Should I go back to school to get CS degree? - Ask Preethi
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
32 Hero Section CSS Changes - Live Coding with Jesse
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
33 Working Agreement - Agile Software Development
Working Agreement - Agile Software Development
freeCodeCamp.org
34 A day at Pennybox with Co-Founder Reji Eapen
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
35 React: Sorting and Filtering Data - Live Coding with Jesse
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
36 React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
37 React: Building a New UI - Live Coding with Jesse
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
38 Definition of Done - Agile Software Development
Definition of Done - Agile Software Development
freeCodeCamp.org
39 Getting started with jQuery (tutorial) - Beau teaches JavaScript
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
40 Making a React Blog with WordPress Content - Live Coding with Jesse
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
41 React, NextJS, CSS - Live Coding with Jesse
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
42 jQuery events - Beau teaches JavaScript
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
43 React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
44 React: Working with API Data - Live Coding with Jesse
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
45 React: Refactoring Components - Live Streaming with Jesse
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
46 jQuery effects - Beau teaches JavaScript
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
47 More React Refactoring - Live Coding with Jesse
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
48 animate in jQuery - Beau teaches JavaScript
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
49 "Finishing" My React Site - Live Coding with Jesse
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
50 Starting a New React Project (P2D1) - Live Coding with Jesse
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
51 React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
52 The Agile Manifesto - Agile Software Development
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
53 jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
54 React Project 2 Day 3 - Live Coding with Jesse
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
55 The INVEST approach to product backlog items
The INVEST approach to product backlog items
freeCodeCamp.org
56 React Project 2 Day 4 - Live Coding with Jesse
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
57 Chickens and Pigs - Agile Software Development
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
58 React Project 2 Day 5 - Live Coding with Jesse
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
59 jQuery: add and remove DOM elements - Beau teaches JavaScript
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
60 React Project 2 Day 6 - Live Coding with Jesse
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org

This video teaches game development using the Godot Game Engine, covering topics such as setting up the engine, creating levels, and adding player characters. The video uses tools like Godot, GDScript, and Node 2D to demonstrate game development concepts. By following this video, viewers can learn how to create their own 2D games using the Godot Game Engine.

Key Takeaways
  1. Download and install the Godot Game Engine
  2. Create a new project and set up the engine
  3. Design and create levels using tile sets
  4. Add player characters and implement movement
  5. Create checkpoints and death zones
  6. Add enemies and implement behavior
  7. Use GDScript to implement game logic
  8. Deploy the game on itch.io
💡 The Godot Game Engine is a powerful tool for creating 2D games, and by using tools like GDScript and Node 2D, developers can create complex game logic and behaviors.

Related Reads

Up next
How to Speed Up Your WordPress Website with WP Rocket ⚡Tutorial 2026
Matt Tutorials
Watch →