Godot 3.2: Let's Build a 2D Platformer!: Part 1 #godotengine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Now that's a great news. I saw your first tutorial series but I haven't had time yet to start it. Hopefully I can give it a try soon. Thanks for helping us to learn (. ❛ α΄— ❛.)

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/Stef7930 πŸ“…οΈŽ︎ Apr 27 2020 πŸ—«︎ replies

very well explained! happy to see more youtubers doing godot tutorials!

πŸ‘οΈŽ︎ 3 πŸ‘€οΈŽ︎ u/[deleted] πŸ“…οΈŽ︎ Apr 26 2020 πŸ—«︎ replies

Really excited about this. Your Simple 3D Game series was excellent, and well-suited for normies like me. You really possess wonderful teaching skills, and since I watched your series, I tried my best to spread the word here on r/Godot. Cynics might even call me a "BornCG shill".

I really hope that the Youtube algorithm recommends your videos more, so that even more average people can benefit from your teaching skills and finally get busy with game creation. This could give us a whole new range of gaming innovations and ideas that had never been explored before.

I'll go through the first episode of your new series as soon as I can and report back here.

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/VRbandwagon πŸ“…οΈŽ︎ Apr 27 2020 πŸ—«︎ replies
Captions
hello animal art one of creating a 2d platformer game in the Godot game engine in this tutorial not so many series we're gonna be creating this 2d platformer video game in this game you control the player on screen using keys on your keyboard of course you can walk and run and jump and fall and explore a large level you can also jump on and squash enemies and get hit and get hurt by enemies and lose lives and get respawned at the beginning of a level you can jump on switches and enable secret blocks collect keys and open locked doors shoot fireballs do wall jumps climb ladders and I'll be showing you how to create all of this again using the Godot game engine over this not so many tutorial series here on youtube on my channel if you're new to my channel my name is Colin I'm a computer science and media highschool teacher I've also been teaching creative technology animation and video game design summer camps to middle schoolers since about 2006 and of course I'm a youtuber here at youtube.com slash born CG let's go ahead and jump in to follow along with me you're going to go and get the Godot engine for yourself the version that I'll be using is version 3.2.40 date and you can get Godot from either triple w kudo engine org or you can get it from the steam store if you prefer Godot is a small download it's about forty to fifty megabytes or so and even on a Windows computer if you download kudo from the official web site there is no installer even on windows I just have the Godot engine program right here on my desktop so if I go ahead and double click on it well it just opens up and I'm ready to go you'll notice on a Windows computer when Godot launches you get two windows you get the command prompt console window which you don't need to have visible on your screen so you can just go ahead and minimize it but it does need to stay open otherwise could do itself will close you also get this window which is godot's project manager and the first time you launch Godot you won't have any projects that you've already created listed here so it'll prompt you to open up the asset library but I'm gonna suggest that you just go ahead and press cancel by the way if this is your first time opening up Godot on Windows it might ask you for permission for Godot to access your network you can decide yes or no depending on what you prefer and the first time you launch Godot on a Mac it may complain that Godot was not downloaded from the App Store so you might need to go into your Mac OS system settings go into security settings and allow Godot to run for the first time when you get to kiddos project manager you're gonna want to go to new project and then you need to tell Godot where to create a new project and Godot needs to have an empty folder to save a new project in what I might recommend that you do is just create a new folder somewhere on your computer like on your desktop or you can use Godot to do that if you prefer what I'm gonna do is I'm gonna go down to the project path bar right here I'm gonna press browse I'm gonna go to not my Documents folder but I'm gonna press the UP button once to go up to my user folder on my C Drive on a Windows computer that's most likely where your desktop folder is gonna be I'm gonna save to my desktop so I'm gonna go into my desktop folder and I'm gonna select this desktop folder and press the button now again Godot needs an empty folder to create a new project in and my desktop is not empty so it's giving me a warning here what I'm gonna want to do is give my project a name I'm gonna call this Platt former game and I'll press create folder and what that will do is it'll actually put a platformer game folder right here on my desktop and then I get a green check box before I press create and edit to start my new project I'm gonna switch over from OpenGL ES 3.0 to OpenGL ES 2.0 and this will allow my game to be compatible on more devices including it'll allow me to export my game to the Internet to an html5 game so I'll go ahead and select OpenGL ES 2.0 and press create and edit when the Godot editor launches you get a fairly intimidating interface so let's go ahead and break this interface down for a few moments to explain the different sections of the screen along the top of course you have a menu bar with common menus like seeing project bug editor and help in the middle of the top menu bar you have toggles that switch between different workspace types you can choose between 2d 3d script and asset library and you'll notice that the main workspace area changes depending on which of these four modes that you're in we're gonna spend most of our time in this tutorial miniseries between 2d and script workspace views you'll also notice along the top bar on the right hand side there are play pause and stop buttons these do pretty much exactly as they sound they play and pause and stop your game project there's also play scene and on the far right you can actually switch between GL ES 2 and GL es 3 in case you forgot to select GL ES 2 when you first created your new project along the left bottom and right sides of your screens you have panels which in Godot are called Doc's and the top-left doc is called the scene doc and this doc is probably the most important part of your screen because this is where you actually construct your game and your scenes out of what are called nodes and noes are the building blocks of a game we'll talk much more about this a little bit later in this video behind the scene doc is the import dock and this is where you change settings for assets like game sprites when you bring them into your Godot project below the scene dock is the file system talk and this basically gives you a snapshot or a view of your Godot project folder so any files you have in your Godot project folder will show up here along the bottom there's a dock that spends most of its time collapsed depending on what you're doing but if you're say edit an animation will this dock will pop up and expand and become a timeline finally on the right side of the screen is the inspector dock and this is a very important part of kodos interface because when you have an object like a character selected in your game you'll see properties of that character object over here in the inspector dock and hiding right below the inspector dock is the node dock you don't see much here but this is where you can create signals and add objects to groups so don't forget that it's there finally the main workspace area and of course you can change between the four main modes of this workspace area along the top using the 2d 3d the script and asset library buttons but again we're gonna spend most of our time in 2d and script okay so let's look at Oh editors interface in a nutshell let's go ahead and start building our game in this video we're going to create a simple scene with a few different physics objects to see how you actually construct objects using nodes in Godot and see how you can save your project and run your game so you can see a physics simulation in action I'm gonna go ahead and press the little plus button here to zoom in on my scene and you'll notice if I scroll over and scroll up that there is a rectangle on my screen marked by a green pink and purple II blue lines this is your game area where the user actually sees the game when they play by the way if you're using a computer with a mouse specifically a wheel Mouse of course you can put your mouse in this workspace area and a scroll up and down to zoom in you can also hold your wheel on your mouse down like a button and then hold that down while you move your mouse and you can pan around your 2d view so having a wheel mouse is obviously very handy so to create a level in my game I need to create a scene and I actually already have a scene scenes are up here with these tabs I have an empty scene right now if I want to create more scenes and you'll see why you'll want to have multiple scenes in your project eventually you can press the plus button to create a new empty one but I'm gonna work with the default empty scene that we already have in order to add objects into my game I need to have what are called nodes and you add nodes over in the scene dock on the top left of your screen nodes are the building block of a game and you can add nodes by pressing this plus button which will bring up the create new node dialog box and in this window you can see all the different nodes that are available to us to create a game nodes are the building blocks of a game so if you want to create an object in your game well you would probably want to create a physics object and because we're making a 2-d game a lot of the objects or nodes that we're gonna be adding are in this category called a branch there are animated sprites that sounds handy there's cameras and lights there are collision objects there physics bodies if you want to add sound into your game well there is the audio stream player there's an animation player so as you can see these are the different conceptual building blocks of a game and if you're creating an object like a character or a block that you're gonna push with your character you might actually create that object out of several different nodes over here in your scene dock their very first note I'm gonna add is actually not gonna be done in this pop-up dialog box so I'm gonna press cancel when you create a new scene you need to create what's called a root node for that scene and you can do this for a 2d scene by pressing the 2d scene button and that will add your first root node to the scene a node 2d again this is gonna be the root node of my scene and that means that every other object in my game is going to be a child of this node so I'm gonna name this node I'm gonna double click on it and type level 1 all with one-word no-spaces now every time I add a new object to my game we're gonna select this node first and when you add a child node to level 1 and you'll see what that looks like right now I'm gonna make an object a physics object in my game so I'm gonna select level 1 and I'm gonna press + I'm gonna go and find under no 2d and collision object 2d and then a physics body 2d and by the way as you expand this kind of tree structure if this is hard to find things in you can search so I'm gonna search for rigid body 2d now don't get confused between blue icons and pinky red icons because pinky red icons are 3d nodes for a 3d video game that's not what we're creating so we're gonna select rigidbody 2d because I search for rigid if you double-click you'll see that the rigidbody 2d node gets added into your tree of nodes making up your scene and you'll notice that this rigidbody 2d is below level 1 and it has this little line here which indicates because it goes down and pushes farther from the left so it's farther away from the left than level-one that this rigidbody2d is a child of level 1 now this rigidbody2d looks like absolutely nothing if i go ahead and pan over back in my view its entered my view for some reason you'll see my game window is right here and my rigidbody 2d if I have it selected well looks like nothing I can't see anything and that's because a rigidbody 2d doesn't look like anything itself on its own in order for us to see this rigidbody 2d we need to add to it a spray and a sprite is a node so I'm gonna select my rigidbody 2d and with it selected I'm gonna press + and I'm gonna search for the sprite node and sprite is it again I'm gonna be a blue node not sprite 3d and I'm gonna double click on it and because I had the rigidbody 2d node selected before I press + and added the sprite this sprite node is now a child of the rigidbody 2d if yours doesn't look like this where you have it indented below rigidbody 2d and if yours does not collapse when I collapse that little branch of this tree like mine does you can actually grab the sprite and drag it on to a different node and that will make the sprite a child of the node that you drag it on so right now it's not set up correctly I'm gonna drag sprite over top of rigidbody 2d and let go so now it's a child of rigidbody 2d and that means they're part of the same object rigidbody is actually gonna be our main object but it's gonna have kind of sub objects now I still can't see my rigidbody object this is gonna be like a block that falls down and will hit a ground and can tumble and kind of fall but my sprite doesn't actually look like anything because we have to load a sprite an image file into our game we actually have one down in our file system it's actually like a dough icon and it's a PNG image file so what I'm gonna do is select my sprite node and look over on the right side of my screen in the inspector dock and you can see here that what the sprite nodes selected I've got properties of this sprite the first property is empty it's a texture what I can do is I can go down to my filesystem dock and drag the icon and not let go of it over here in the middle of my screen I'm gonna keep dragging it and let go of it over this empty texture section and now I actually have this sprite with a texture and now you can see it in the game now you might be tempted to right away move the sprite but don't because your game object actually thinks because the game object itself is a rigidbody 2d it's the physics object of the object it's the main object it still thinks if I select it but it's up here in the top left corner of my window so now my rigidbody thinks that's here and my sprite thinks it's down here so I'm gonna press ctrl-z on my keyboard and leave my sprite at 0 0 the same place as my rigidbody for the time being now my rigidbody 2d has a little error icon next to it and let's go ahead and click on that to see what it says it says this node the rigidbody 2d has no shape so it can't collide or interact with other objects consider adding a collision shape 2d or a collision polygon 2d as a child of it to define its shape so what this is telling us is that this rigidbody 2d is a physics object and by the way rigidbody 2d s come with gravity built-in so they'll fall automatically but in order for them to bump in with other objects in your game it needs to know its shape and that shape property is not actually a property of this rigidbody 2d node it's a separate node that we're gonna add as it's a second child so I'm gonna select the rigidbody 2d and I'm gonna press this plus to add a new node I'm gonna search for collision co ll I s to give it a good start and what I want to add is a blue collision shape 2d not collision polygon buck vision shape 2d and I'm gonna double click on it and so now hopefully if your node setup is like mine you've got a level 1 and as a child of level 1 you've got a rigidbody Toodee and as a child of that you've got a sprite in a collision shape but this collision shape has its own air but at least by it by adding it we got rid of the air of the rigidbody2d but this collision shapes air says shape must be provided for a collision shape to e to function please create a shape resource for it now the key word here is resource I'm gonna press ok a resource is something that you can add inside of Godot that gives a node more information if I select this collision shape to denote and then go over to the inspector dock and go to the shape property of this collision shape you'll notice that the shape is empty I'm gonna go ahead and press the little arrow next to empty and this is where I'm gonna create a shape resource which will define if this object should be a circle shape or a capsule shape or a rectangle shape we're gonna select in this case rectangle now you might not see it on your screen but it is there if I go ahead and zoom in by scrolling up my mouse over it in my 2d workspace you're gonna see that there's a little aqua square over top of your sprite this is your collision shape it's basically the force field where this rigidbody 2d will hit other objects but this little shape I'm gonna go ahead and hide my sprite for a moment is too small obviously it should match the size of my sprite so I can grab these little pink and white handles and move them out and expand my collision shape to match my sprite and there we go my object is almost complete I'm almost ready to save this scene and run the simulation but if i zoom out and I want to move I'll pan over with my mouse wheel pushed down like a button so I can see my entire game rectangle again if I want to move this rigid body block that I want to fall down into the middle of my game if I just click and drag it well I just dragged the collision shape separately from the object itself in fact if I grab the sprite and move it again I just drag the sprite and the rigidbody 2d my physics object still thinks that it's up here so I'm gonna press control Z few times to get things back at 0-0 in my game and with the rigidbody 2d nodes selected I'm gonna press this button right here I'm gonna call this button the glue together button to glue things together but what it's really called is make sure the objects children are not selectable if I select my rigidbody 2d and press this button you'll see that little same icon appear almost right here and now if I drag my physics object its children the sprite and the collision shape 2d move with it ok so now I have an object by the way let's go ahead and name this object rigidbody 2d is not a very good name I'm going to double click on it and type block 1 and press Enter so now it has its name let's go ahead and see what this game looks like I'm gonna press not the play button I'm gonna play this individual scene so if i press this play scene button it's gonna ask me hey this scene has never been saved saved before running yes let's go ahead and save this scene a scene in Godot is a file it ends with dot t SC n it gives the scene the name of its root node so level 1 dot es en I'll press save and oh you know what I've got this network warning from Windows I'm gonna allow Godot to access my private and public networks and I'll click allow access and hopefully that's fine but the game actually did run and can I see it no I'm gonna press play scene again and it'll launch and there we go there's my game object and it's falling because there's gravity built into rigidbody objects and it fell off screen and you know what it's still falling so I'm gonna add another object to my game I want my my block to fall and hit a floor so I'm gonna select my level 1 in fact I'm gonna collapse block 1 first and with a level 1 selected I'm gonna add a slightly different kind of physics object I'm gonna add a static body physics object and a static body physics object does not move but it can collide with other objects so what static it doesn't move like a floor let's go ahead and select level 1 I'm gonna press plus you'll notice that by the way when you start adding nodes you'll get recently added nodes here I don't have the static body physics object here yeah because I haven't added it yet in this project so I'm gonna search for static and there it is static body 2d again not a pink 3d version but the 2d version and I'll select it and add it so there it is I'm gonna name it right away floor and I'll press Enter let's go ahead and add to it just like with the rigid body object I'm gonna add to it a sprite so I'm gonna select it press the plus I'm gonna add I'll just put on my recents here sprite I only have one sprite in my game so with a sprite selected I'm gonna give it the same texture as my block I'm gonna drag the icon over to it's empty texture there it is again my floor is up here still right we're gonna leave it there until we glue it together I'm gonna stretch the sprite out though and while I'm stretching it from the side I'm gonna hold the Alt key on my keyboard just to make it wider and keep it centered there at zero zero in my game so my floor our physics object has an error hopefully you can predict what this is gonna say it's the same air that we had the first time it says this note has no shape consider adding a collision shape to D again we'll do the same thing so I'm gonna press ok I'm gonna select my floor I'm gonna press the plus I'm gonna add a collision shape to D and again you can search for these things if you don't have them here in your reason's for some reason collision shape 2d there we go and again if yours doesn't add as the correct child orientation to floor like maybe it appears like that well you can just drag it onto the floor oops drag it onto the floor there we go to make sure that the sprite and the collision shape are a child of the floor the collision shape has an air but we now know what that air is a collision shape needs a shape resource and I'm gonna add to it a rectangle shape 2d shape and now if i zoom in and pan over I can grab these little pink and white handles and make it wider and taller and by the way we will be bringing in different sprites into our game don't worry our game will not look like this but now that we have a completed floor of sorts let's go ahead and select the floor physics object press the glue together button we can zoom out and pan over and I'll grab the floor and put it below my block and now if I go ahead and press play scene it'll launch my physics object will fall and it'll hit the ground if you don't like how fast your physic simulation is running like how fast the block is falling if you select your block physics object and then you go over to the inspector you can change the gravity scale of that object I'm gonna change the gravity scale up to maybe 12 and press Enter and now what I press play seen the game will run and the block will fall faster okay but let's make this a little bit more interesting I'm gonna select my block one I'm gonna use instead of just the select tool up here I'm gonna use the rotate tool and now I can just click and drag in a circle to rotate this block and let's see what happens when I press play scene so it falls and tumbles just like a block and because these nodes are very modular what I can do is I can duplicate whole branches of my scene by the way a branch means when you collapse or expand a child node of your root node this is essentially a branch and this is essentially a branch when you have children of children of the main node those are called branches if I select the entire block one branch like this the root node of that block one and I right-click on it I can say duplicate and because block one is named with a number at the end well duplicate knows to make the next number in that sequence so now I've got two blocks they're in the same exact spot though so I'm gonna use my select tool and select and move one of them so now I've got two I'm gonna select I'm going to collapse them both actually and select both of them right click and duplicate and now I've got blocks three and four let's this make it a little bit more interesting or something like that and that let's go ahead and press play scene okay so that's where we are gonna end this video we've got a scene for our game setup we've got physics objects that fall they're called rigidbody 2d s you're now familiar with godot's in your face and starting to create a 2d platformer video game we have done an introduction to nose and creating objects in a 2d video game in the next video in this mini series we're gonna create our character and we're gonna start programming our character to be able to move immunes walk and fall with gravity in our game but that will be it for this video of course if you like this video over doing something--in please go ahead and take a moment and click on that like button it really helps me and my channel out if you want to see more videos like this one in the Godot game engine or in blender 2.8 click on that subscribe button as well and click on the bell icon to be notified whenever I upload a new tutorial check out my facebook page at facebook.com slash born CG on that page I post sneak peeks and previews of what I'm working on next but that'll be it for this video thanks for watching let's see the next one bye [Music] you you
Info
Channel: BornCG
Views: 122,973
Rating: undefined out of 5
Keywords: tutorial, lesson, beginner, Godot, platformer, platform, physics, nodes, ui, user interface, learn, basic, rigid, rigidbody
Id: HvPTSZl2WCc
Channel Id: undefined
Length: 25min 51sec (1551 seconds)
Published: Sun Apr 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.