Godot Tutorial for Unity Developers (and other beginners)

**Mastering Good D: A Beginner's Guide to Game Development**

We'll make this lower case as well we'll say if the wall is in the body then we can Q free now now we can delete this first of all but this is basically checking to see if the property is in that wall that we or the body that we just collided with so let's play and now it should work relatively fine let's test this one more time by going to the second pipe and there we go all right we are almost done we just have a little bit more.

**Testing and Refining**

We'll create something called a global script. How do we do this well first of all let's create a new script we can either go here right click oh I guess they removed that I think we can go to file and say new script or contrl n or we can go to the res file on the bottom left create new and create new script we're going to create something called game or Global and in this Global we're going to remove all this and say variable point we're going to set it to zero this is the points that our player is going to collect now in our pipes we're going to create an area 2D that is going to ding or give our player a point every time we hit it so let's create this and add a collision shape. Now how are we going to make this work well it's actually pretty simple we just have to create a long rectangle we're going to move this all the way to the right where the pipe should be and we're going to make it relatively skinny.

**Adding Collision Detection**

We'll go to the area 2D and say if body entered connect this and we'll say if bird inbody body. name because the bird is not a variable but it's the name of our Bird right so now let's go back to our pipe and we're going to say Global do points plus equals 1 however this should error there we go not declared in current scope. Now how do I make this Global how do I access the script from this script well on the top left we go to our project settings this should open up autoload we go to autoload right here this is where we can autoload or globalize scripts or even scenes so if I click the folder button this guy will pop up and you can see I can actually select the scene too however we're just going to select the global script and open this now it says the path we're going to add it this is the name of the script to access it we're going to close it and this should work. Should unair sometimes if it doesn't work what we can do is close this and play it again or open it and there we go.

**Displaying Game Points**

In my world we have no way of keeping track of the game points so let's add something let's go to our world and add a label this label is just a label it's basically text so if I go to the inspector and add text I can write a bunch of gibberish but that's not what I want I want to create a script onto this and we're going to say self. text is equal to string because I'll explain it in second global. points because we have to convert this points into a string because this is actually an integer and text is a string we cannot set a string with a integer it has to be a string okay so this should allow us to show how many points we have.

**Conclusion**

Let's play and we see on the top left we have the points and every time it pass to the pipe increases the point and if I die it should not increase the point. That's it all right that is pretty much the end of this season series I hope you enjoyed it and I'll see you guys congratulations you have finished this video the mini course if you guys enjoyed this course or little video I made um please subscribe uh share the video with your friends or other Unity developers that have not transitioned yet um what else if you guys liked my content um I'm going to be working on a course coming up soon is going to be a really really big course consisting of not only how to master good D but also game development and getting started in game development um it is not out yet most likely it's going to take me a while to get it out however if you would like to support me on that and my development of that course um I would appreciate it to either support me on patreon or I will have a Kickstarter soon so please subscribe to stay updated on that um also join my Discord which will also be in the link down below again congratulations for finishing this video it was pretty long um hopefully you can continue on with this project and build on it and who knows maybe you can release it probably not because the assets are you know flppy bird but that's okay I hope you enjoyed making your first game in good D

"WEBVTTKind: captionsLanguage: enin this course you'll learn the basics of gdau for game development this course is perfect for Unity developers transitioning to gdau but it will also help people who are new to game development in General Omar Zaki teaches this course he is an experienced game developer and has created many popular good old courses you'll learn how to navigate the interface and build a simple Flappy Bird game hi my name is Omar and I assume most of you guys at least close to the update of this video are here because of unity um a lot of you guys are quitting unity and have decided to pick up gdau and so I have made this video lengthy video it's about an hour long to help you transition into gdau this video is not how to become a game developer it does cover some basic topics of game development however this video is mainly focused on introducing you to the gdau engine not GDOT whatever they say it is gdau um so I hope you enjoy and I hope you learn as much as possible from this video this video definitely will not cover most the nodes it is mainly just how to navigate the interface of gdau and how to actually get started on your project hopefully um your transition from Unity to gdau is not too brutal or if you're not even transitioning your just picking up gdau and want to learn game development this is the right place for you this again is a complete beginner video just how to pick up gdau so I hope you guys enjoy this video and I will see you at the end of the video our first step is going to be to get familiar with the gdau engine and actually making sure we have all the assets we need so here we have our Flappy Bird assets and we also have the goo engine uh executable file so here here was my Z file for that I'm going to delete that I'm going to extract this we have our file here I'm going to delete this we're going to launch the gdau executable we're going to create a new project I'm going to browse it and put it in my desktop going to name this fory bird YouTube tutorial here on the left we have three different kind of renderers now for 2D usually I use compatibility for 3D you would most likely want to use forward and mobile is well for mobile for very less Advanced 3D Graphics um as you can see there's a little uh description of what everything does so let's select none for the Version Control because I'm not going to put this on GitHub I'm going to now create folder because we see here it gives me an error and is telling me to create a folder now I can create an edit and here we have our fresh project project now let's take a look at our interface here on the left we see we have the file system this is where all the files that we create with scripts and scenes and anything else will appear this is also where we will be importing our file soon on the top left we see create node now this will change in a bit however this is where the node structure will generally be this is where I edit and change my scene we can also see the import tab is also on the top left and we have a few other uh settings on the top above that now in the middle as we can see a giant screen we see the project tab this is where we see the actual scene and on the top right above that we can actually change it to 2D now on the right hand side we have inspector node and history this is the inspector but it's also Al the property panel usually so when I change a node or an object in my game the properties will be on the right hand side on the bottom we have a bunch of other useful things as such as output debugger audio animation and Shader editor there's going to be a few other things that might pop up depending on what node you're using for example tile map or tile set can add an extra thing which we will be doing in this video output is usually for things like print which we will also be looking at in a bit all right so at this point we want to actually import all our assets so we're going to minimize the screen like this and we're going to find our folder so here is our Flappy Bird folder assets all we have to do it's really easy we just take it and drag it into our screen if we make sure we select this drag it and put it into our folder it's going to say res we just drag and drop it and it should import now we might instantly see a problem now the first problem we see I'm going to drag one of these pictures onto my screen it's going to turn into a Sprite on the top left here we see the icon for the Sprite and if I select it by clicking it on the right we see that it says Sprite 2D now if if I zoom in we can see it's kind of blurred so in order to fix this we have to change the properties of this now what we can do I believe in texture sorry here we go in the texture property we will go to the filter and select nearest now if I zoom in we can see it has become pixelated however I don't want to do this every time I import and or add a Sprite so we're going to set the default now here by default if we actually reselect this and click the loop it'll say inherit now what does inherit mean inherit is going to inherit the default project settings now if we go to the top left and click project settings or project we see project settings if we click that we'll go to down here we can actually just search up fil filter and we should find rendering Textures in the textures we'll find default texture filter at the moment it is set to linear we want nearest we close this we now see if we zoom in it has become pixelated and the filter on the right did not have to change now the advantage of this is if I delete that and add another uh PNG we can see that it is proper ly pixelated and not blurry well the background is blurry but that's just how the background is so I'm going to delete this and now we have imported out our assets and we have set the project setting now let's go back into our project settings and we're going to actually change the window so let's clear the search we'll go to window display on the left and we're going to actually switch this to divided by 3 and then divide this by three and then we're actually going to switch these so this is going to be 384 and this is going to be 216 so let's make sure we have these and on the stretch we're going to go to the mode and keep it as viewport and then aspect we're going to expand and now we'll close this and now we see that our blue window has changed now this is essentially a camera if I were to play nothing's going to happen cuz we don't even have a scene yet but we'll actually do that right now so let's go to create root node we'll create a 2d scene because we want a 2d game we need a 2d node as the paper what that we draw on essentially this is going to be a piece of paper that we actually draw on and add Sprites and nodes and other things to it so let's contrl s to save I'm going to name this file world and we see that it is saved as a TS CN this stands for scene we also see here that it's going to be recognized as other things but we just need it as tscn we'll save this and now on the left we see world. TCN has been saved and if I click it this opens right it's already open but that's okay now if I click play run project or F5 we can select or select current select we'll open this folder and we can select this to open it and now we see our folder or our screen is right here now if we want to change the actual size of that screen that just appeared we can go back to project settings and instead of switching the viewport and width we're actually going to select advanced settings and here on the bottom below the viewport width I'm going to copy this and here under all the way at the bottom we see window width override now this is going to be overriding the actual screen we see this is essentially the pixel size that we see and play with in our screen so make sure we take a look at the top right here we see that this screen is approximately 250 technically it's 216 that's what we set it to however if we go to the window width override and multiply it by maybe two and then go to the height width override and then multiply this by two we now have these settings and if I click close this did not change however if I click play our screen is now a lot bigger so that's all the override does if you were making a mobile game for example this would not matter because on a mobile game the screen will automatically resize to the Android screen you have or the iOS screen on Windows this matters more because that is the window that we actually play on now I will let you play around with these values do whatever you like but these are the settings I'm going to work with now one additional thing if you accidentally select a different scene to play automatically here we have run project this will play the project completely from scratch from the very first scene now let's create another scene let's create this scene just for the sake of having it so I'll save this as node 2D if I right click this H here we go now we have this that says set as main scene so now if I play it looks the same but it's now going to be running the node 2D instead of the world and I I can actually confirm this by going to the left when I play I See remote and local local is the local things that I edit the remote is the live version here we have root and it also says node 2D we can confirm this by saying by hovering it and it says instance node 2D it shows us the file path now this is because we have set this to play this on the main now I can stop this by clicking this on the top right or by clicking f8 now I'm going to close the node 2D go back to my world and now I'm also going to rename the node 2D to world all right let's get started in actually creating something so the first thing I'm going going to introduce is something called rigid body 2D now in order to add objects into our game unlike Unity or some other engines you might have used everything is already essentially preset now in order to add that specific object you want we go to the top left under scene and click this plus button or contrl a now we have this window that says create new node and all these nodes are essentially objects here we can see the node 2D and it's actually organized quite nicely most the things that are 2D will be under the node 2D if I click this I can see a bunch of 2D objects now instead of just looking through all this I'm just going to use the search bar I'm going to search up rigid body now if I click the X it doesn't select it so I'm GNA actually find it for the sake of introducing just bodies here we go it's in the Collision object 2D so here in the Collision object 2D we see that we have physics body 2D we have static body character body and rigid body 2D now rigid body is used for things like balls or things that need physic uh physics simulation right so I think the classic example is a ball because a lot of engines like to compare those kind of uh physics and I will just say right off the bat if just in case you are from Unity one of the main differences that at least I'm aware of of the rigid body 2D in good and just not even 2D but just rigid body the 3D as well versus Unity is that the rigid body in uh gdau actually Sim simulates a real ball so when you drop a real ball generally it has momentum and it stops eventually whereas in unity the ball will keep bouncing to the same height whereas in goo it'll eventually stop and get to the ground essentially now we're going to create this by selecting the rigid body 2D and create now here on the left we see rigid body 2D but we also have an air on the right now if I hover this it's going to tell us we just need a collision shape so let's do that let's control a or add a node and we're just going to search up Collision shape now we have a lot of collisions we need a collision shape 2D Collision polygon can also work but Collision shape is a little easier so let's add that now let's zoom in to this point because that's where it is we can see it by either hovering or just selecting it in general it's already selected now if I give it a shape on the right I'm going to select a circle shape because my bird is going to be a circle now we can see there's not really anything here so let's add our player so let's go to the left on our files and add our player so we have three birds we can add from I'm going to add the red one we can see that it's automatically turned into a Sprite now in gdau there are quite a few ways to animate things so this gives quite a bit of flexibility in how we want to do things so we can either go to animation here and type in the H frame 4 if we do that it'll take the frames that we had and turn it into this now there's something called animation player which I'm not going to get into but that will it's actually a very powerful tool in gdo that helps us animate various things so if I wanted to animate from 0 1 to 3 for frame it could do that however I'm going to do an E easier method and I'm going to use something called animated Sprite so I'm going to go to my rigid body select my rigid body I'm going to add a node and search up animated Sprite we see animated Sprite 2D let's create here it's basically telling us we need to create a Sprite frame so on the right let's go to Animation Sprite frames new Sprite frames click this and here we have a new selection on the bottom that says Sprite frames now here it says default but I can double click this and rename it to fly now here it's already automatically looped but here we have no frames so let's add some stuff now you could drag and drop but this adds a frame this is frame zero that's not exactly what we want so let's delete that what we want to do is we want to add these four frames into this as separate frames and luckily enough good can do that if we click this rectangle but button little thing we'll find that this pops up and we can find our Sprite that we want to add I'm going to do the blue one actually and if we zoom in by holding control and zoom in able to zoom in and on the right side used to actually be on the top but they changed it so it's on the right I actually don't like that I like it on the top but that's okay we're going to go to horizontal and select one nope sorry four and then vertical we'll do zero or one so now we can select all these and we can see that the numbers actually correlate to the order so if I did this it would be a different order now we can just unselect it all and then select all and it'll do it like that that's probably a bit easier so select all on the top or select none and then select all so make sure we have select all and we add all four frames and now we see all four frames have been added now I can play test this by just clicking this play button and it automatically loops now what I'm going to do is I'm actually going to automatically play this that way it plays on when I play the game now if I run the project nothing is really going to show up so what I'm going to do is I'm actually going to take my rigid body and I'm going to move all of it by instead of clicking and dragging you can see here I've only moved the Sprite what I can do is either there's a lot of options I can either take these two by holding one of them and then shift and selecting the other or control and then I can lock it and now I can select my rigid body or if I don't want to do that which I usually don't I can just select my rigid body I can click this guy the move mode or W and now I can just move the rigid body from anywhere it's a lot easier to move things around now if I play again nothing that's very interesting let's find out what's happen happening most likely it's just falling before we can even see it so let's go to the remote and see what's happening oh I see what's happening we're not playing the correct thing so let's make sure we select this as the main scene and I'm going to delete the other node that I made there we go there's our birdie and as we saw it automatically Falls it has its own built-in physics and gravity that it just automatically Falls we can find it by going to the by selecting the rigid body 2D and going to the right side with the properties panel we see linear and angular velocity we're going to actually play with both of these in our script in a bit so I'm going to unselect those we don't want to select anything here we see the transform this just shows us the position rotation scale and skew skew is actually new in gdau so if you would like to play around with that you can see what it does it's kind of interesting but I'm going to leave it at zero um um we're not going to really play them around with too much so now what we're going to do is we're going to actually add a script to our bird so let's actually rename this to bird then add a script as you might assumed the script is up here on the right or on the left sorry with the little paper thing that says has a plus button if I click that it'll prompt me to attach a note now there's a few options the language I could change before there used to be um don't remember what it was called but it was like another GD thing um but either way you can also I believe import C into gdo um I don't know how to do that I've never tried it I've never done it but there are videos out there that you can find that will allow you to do that if you prefer C over GD script now I will give a not warning but I guess just a general knowledge thing is that GD script is basically python if you know python or if you have an inkling of what python how python works you'll be fine GD script is very similar to python it's essentially the same but GD script just has its own builtin functions which is very useful which we're going to be taking advantage of now we see here the inherits this will actually see what this does in a minute when I create this but what also matters is the template and the built-in script template is actually new which is cool there's no template real template for the bird or the rigid body however for some other nodes there are some templates but either way we're going to leave this as node default for the built-in script this if I select it essentially I cannot find the script in my files it is a built-in script into this node usually that's not what you want to do because if I create this let's create it here we go if I hit control shift f I can find anything in my file so for example let's say rigid it will now show me on the bottom the find rigid and it'll show me the things that have rigid in it now if I had made it built in so let's actually take this out and delete this script if I do the same thing make it built in and let's go to output and then say rigid nothing shows up because it's builtin it's a buil-in script that we cannot search through our files so let's make sure that we have it not built in and create and here we have on the right left as well we have an unsaved thing this is just the the other built-in script it's a little wanky sometimes but we're just going to use this all right so in our script we want to take a look at the code that we have so far because right now it's not much but what's Happening Here is it's going to extend the rigid body 2D which is basically a class which is rigid body 2D that looks like my headset is low but I'll charge that in a minute here we have two functions the ready function it's called when the node enters the scene and we have the process function which is very useful but we're not going to use that just yet we're going to create a new function called function input event this is a function that checks for any sort of event so if I print the event and I go to output on the bottom left and I play my game and I start moving my mouse or even clicking a button on my keyboard anything this is any sort of event now the question becomes how do I specify this to a certain type of thing well I can say if event is input event Mouse button then we'll print the event now this is what this is going to do is if I restart the game it will only take something if I click even if I move my mouse it won't input that because that's not a mouse button it is a motion so if I actually control and left click on this it will go bring me to the input Mouse button um document and I can even click the online document I won't now there's also the search help and we can kind of look at what this stuff has I'm not going to I'm going I already know so I'm going to teach you so when I look in my game let's restart this if I left click we see that the button index is one and the button mask is one and zero that means I click down so if I click down once and then release the button mask is zero if I right click the button index is two so now we can actually check for which button I'm clicking on my mouse and I can do that by saying if event. button index is equal to one so we're taking the event and looking for a property button index is a property of the event so the event here is the thing that I printed so this is the entire event but I only want the button index and I do that by saying button index similarly we can do event Doods or press or anything else you can even check the position by doing event. position okay so now we want to add linear velocity to our player every time I click now how can I do that well there's something called linear velocity however you'll see in a second so if we want to change the Y maybe let's subtract 150 so in Gau when we add or subtract to the Y y AIS the Y AIS is actually negative in the upwards Direction so if I look very closely on the left we can see that this says 50 here and if I go up a little bit this says 50 so I want my bird to go upwards when I click and I do that by subtracting 150 now let's try this oh that's a little weird that's not exactly what I want so what we're going to do is we actually setting it like this is very strange now every node not every node but most nodes have a a builtin function for these type of things now this one is set do linear well set linear velocity to this velocity now I can't just pass through ay I have to give it a vector 2 so Vector 2 is just an x and y coordinate now the X I don't want it to move in the X Direction because that's right and left I only want it to go upwards of 150 now calling self is the same as not calling self so if I do this it's the same as saying self dot I just like to get into the habit of doing self Dot and then the function just so it's a good habit so that way you see what all these things are doing to what right so now we know that we're setting the self to the linear velocity now if I play we can see we have a little bit of jump it's a little better than it used to be now to make this a bit more fun we're going to do the same thing but we're going to say set angular velocity to negative maybe let's change this to negative one and see what that looks like and now you can see our bird is kind of flipping I think I'll keep it tog3 so it's a little quicker now we can see our bird is flipping like that so it looks a little cooler okay we also you also have the option of playing the fly animation only when you click so to do that we can go to our animated Sprite make sure it's selected we have it here on the bottom we're going to turn off the autoplay and we're going to turn off the loop now what we can do is we can take our animated Sprite and drag it into our script and it gives us the path to our script now what does this do this essentially gives us access to the animated Sprite so now what I can do is I can call something from that and I'm going to say play Fly it's going to play this animation for us now we see that there's a bunch of other properties that I could put but I'm just going to leave it as fly this will work fine so now when I play my bird is not doing anything and it's very subtle but now he only plays the fly animation when I click cool all right now we've learned how to animate access animation Sprites we've learned how to change properties now we're going to edit our scene a little bit let's go to our main scene and I want to add something called a parallx background which is up here parallx background we're going to create this and what is this well it's basically a parallx background layer so let's add a another node and we're going to add a parallx layer now let's take a look at how this works if I take my background I'm going to add this one take this background transform it to 1.5 to move it down a little bit and in case you're wondering if you want to turn on or off the GD snap which is useful you can easily do it with shift G or this guy right right here all right so I'm going to move this in the middle and I don't want this to move so I'm going to put it right there Above The Parallax layer now in the layer we're going to add something we're going to add our pipe to see we're just going to add this guy just to test it now you see when I tried adding it it just added it over here in the world we want to move this to be a child of the Parallax layer all right we now have a pretty complicated setup on the left we basically have the parallx layer a child of the world which is fine because we are playing in a 2d world we have the paralic background which is a parent of these two nodes and the parallx layer is what we're going to use to move so let's go to our parallx background and we're going to add a script we're going to have it built in and you don't have to make it built in but that's so it's up to you we're going to edit something in our process function we're going to change the scroll base offsetx and we're going to subtract scroll speed times Delta now what's scroll speed well we have to give we have to give that variable like into existence because it doesn't exist so let's say variable scroll speed is equal to zero now in Gau variables are just called variables now if I want to specify a specific variable to a type here right after I think it's here let's find out together we can say int like this and this will specify that it's an integer now either way it doesn't really matter because gdo is actually smart and will automatically kind of assume what this type is so here when I just say equal to zero it's automatically assuming that it's an integer now this is nice but I'm going to add something called export we're going to to export variable scroll speed now what does this do well if I go back to my 2D scene and I click the parallx background and I look at the properties well now I see it says built-in script and then right below that it says scroll speed and now I can change that to 50 or whatever number you'd like now if I play our background is moving the parallx background is starting to move which is great that's really cool so this is pretty neat one more thing that's usually used in parallx background is called mirroring now if I want the same background to show up I can mirror it by maybe giving it 100 usually you want to give it the same number that is this one so 26 zoom out and now if I play it should duplicate so forget the bird we don't need him have that one that's the second one and there we go there's our third one right even though we didn't draw a third one it is now showing up in our game right and it's going to keep mirroring forever so that's very useful but that's not exactly what we need but it was a good thing to see what this is now let's delete this parallx layer and we're going to add something called a tile map now gdau is actually pretty unique in their tile map because it's really it's a really power ful tool than not many other engines have so in our tile map we see tile set on the right side up here it says empty so we're going to click it and give it a new tile set now on the bottom we have tile set and tile map in tile set this is where the editing happens any sort of editing to my tile map is going to happen here any sort of application that I actually put into my game will happen in the tile map hopefully you understood that if not that's okay we're going to learn this with an example so clicking our tile set on the bottom we're going to take the tile style one because this is the ground and we're going to drag this in we're going to click yes and we're going to scroll down a little bit and we're just going to take a look at here now the do 4 I actually just changed this so it's a little I don't know if you want to call it easier or harder but it's really cool so pay close attention we're going to go to the top right we're going to click tile set on here we're going to click this tile set now this these new properties will show up and we see physics layer and a bunch of other things the only one we're going to focus on right now is physics layer we're going to click add element and this has basically allowed us to create a physics layer so now we're going to unel select that and close this we're going to go back to our tile set because remember if we want to edit anything from our tiles we have to do it in the tile set right so now let's go back to paint actually I'm going to give a quick demonstration as to why we need to do this let's go into our tiles into tile map so make sure we're in tile map and we see tiles here we can select a tile and now we can just draw now okay if you have move mode selected it won't allow you to draw you have to have the select mode selected and now we can see the tiles right there so let's draw along the map and let's maybe put this one now we can also paint or use a rectangle like this to make it a little easier or quicker will make this easier for us now if I play what's going to happen well my player just fell right through that's not what we want we want an actual physics layer now in my tile set again we're going to go back to the tile set we're going to go to paint paint properties and we're going to select the physics layer right here we have physics layer now if we did not create that physics layer you will not see this if you did not see this physics layer please go back you missed a step okay so let's click this physics layer and now we have some things here let's drag the up a little bit so we see everything now here it's actually very neat because we can specify the physics um layer for all of these tiles now I'm just going to select all of these because it doesn't actually matter but for future reference you can actually change these points and change the Collision see that very cool so I'm not going to go too much into detail about tile Maps there are I actually have a relatively good video on tile Maps it's about 23 minutes long and you can check it out is I it's in my channel somewhere you can find it um but um there are a lot of tutorials on to Maps so we're going to just do this and let's play Let's see what we have now bam he hit the floor but we can see that there's a little Gap why is that happening I want you to try to take a guess as to why this is happening so pause the video and try to figure out why there's a little Gap there hopefully you've unpaused well if we scroll down into our bird we see that the physics layer of our bird is this big so it it's working how it should so if we select our Collision map shape we can see here if I try to drag this up and down it's not working very well and that's because we have the grid snap turned on so let's turn that off by clicking shift G or just clicking that and let's pin this down to fit our bird properly cool so now when I play it works as it should awesome all right we now want to add a way to detect if we hit the floor or the pipe in the future so right now we have the tile map called tile map we're going to rename this to walls this is going to represent the walls or the the floor in fact actually I'm just going to rename it to floor I don't know why I renamed it to wall but FL is probably more appropriate now in our bird we're going to add a new node called area 2D so if I add a new node add this node called area 2D and now it's part of our bird and then we need to add a collision shape which we can actually find in the recent as well or you can just search it up whichever one you prefer now we see that it needs a shape so let's actually Zoom in here because this is important when we play with area 2DS with Collision shapes with the actual body or rigid body if this area 2D is smaller than this Collision box or the same size I believe it becomes inapplicable and it basically can't detect anything so you have to make sure the area 2D Collision is bigger than the Collision shape of the actual rigid body okay let's zoom out and now in our area 2D we're going to go to the top right we have inspector and then something called node now node is where all our signals will be there's also something called groups but there are a lot of videos about that and you can check that out groups is uh completely separate from not from signals but we don't have to worry about it right now we're going to focus at the signals in general so let's take a look at what sort of signals exist first of all it's important to note that these signals here are all specific to the area 2D these are built-in signals or functions specific for area 2D now there are other signals that are general for other things like node or canvas item or Collision object or object on the bottom and in fact if we go to our bird and select this bird instead we see there's different signals but these are all the same that's because they all inherit the same type of node now let's go back to our area 2D we want to connect a body entered this will basically look for anything with a physical body you can see you can read it and it says tile map in there so we're going to double click this and if it'll actually automatically prompt us to select this the script of the bird now if it prompts you to select something else we make sure that it's prompting us to send the signal to the bird let's connect connect it now we have this signal so what is a signal what what is this thing well when this bird and the area 2D specifically the area 2D hits anything the signal will proc whenever a b body enters whenever a body enters this area this signal will proc and basically get and say hey something happened right and what do we want to do well first let's print the body let's see what it says let's print the body. name because the name is actually a property so here we renamed it to floor it should print floor if we hit the floor so let's play and see what happens ah so it says floor and bird but why does it say bird well that's because the area 2D actually collided with the Collision shape as well so what we're going to do is we're going to add a if statement that says if the body. name is equal to floor then we're going to Q free this is basically going to delete our player our bird oh there he goes he got deleted cool we have a relatively somewhat working game with no pipes and we can stay alive and it works pretty well and if I hit the floor I die all right so let's start adding some pipes because well this isn't fun without any pipes right so let's take a look at how we're going to add this pipe well I want to actually add a new tile map and in this tile map we're going to go to the tile set new tile set click this go to tile set here and we're going to add whichever pipes you want there's this one I'm going to add this one and there's also this one which you can add I suppose I don't know uh actually I'm going to add the bottom one because I think that's the one I used in my reference so I'm going to go back here and delete this by clicking this and now I have the pipe style actually one more time it should now one thing I will say is you will notice the ID changes and this is important for later but at the moment I'm just going to make sure that the ID is zero to stay consistent okay now we see here that the tile set is a little weird it's a bit different now what we want to do instead is we actually want to change the X and Y texture and we can do that by going down here and typing 32 oh no sorry 32 for the X but 16 for the Y and now we can select this entire thing we also want to do the same thing for the tile size up here so we're going to say click 32 now we can select a tile like this now let's go to tile map and add it we can see that we can actually add a tile right so I can do this can delete it by right clicking let's add a long pipe here that and we can do that and now we have a pipe let's also add a physics layer now I want you to try this remember how we added the physics layer and added the Collision so I want you to pause the video and try this and give it a try P an element tile set we're going to go to paint physics layer we're just going to select all of these you can see here that we can even edit it here I'm not going to care too much about the tiny Collision here like you could do this if you'd like if you are very specific about it I guess I just did that but yeah so you can do that and now the is very specific all right so now we have this tile map that doesn't move right because if I play it just stays there now usually you would think that we want the bird to move forward but what we're actually going to do is we're going to rename this to pipes and then we're actually going to attach a script to this we're going to not make it buil in this time let's create it and in our process function we're just going to add something very simple we're going to say positionx minus equal 60 which is basically speed time Delta now let's go back to our 2D script or 2D scene and play now we see that our pipes are moving it looks like our bird is moving towards the pipe but the pipe is moving towards us and I collide with the pipe now what we can do is go back to our bird and add I want you to try this add a check to see if you can destroy the bird when you hit a pipe pause the video give it a try and unpause when you're done or confused all right so all we're going to do is I'm going to duplicate this and type in pipes now when I play and I hit the pipe my bird goes away cool so in our script we actually want to randomize this now how can we randomize this well I have created a relatively complex script that you probably shouldn't do but I've decided that I'm lazy and I don't know I just like doing it this way so let's um take our pipe and we're going to actually Save branch as scene nope wait yes yeah I was right okay we're going to save the branch of scene and now this thing appeared says open an editor but what is that what does that mean well what we can do now is we can actually take this and delete it now don't worry it's not gone we've actually have it over here now in our pipes we can see that we have our pipes but over here it's not here so first of all we want to be able to spawn in these pipes and then we also want to randomize the Gap essentially now let's look at the randomization first because that's a little lengthy you don't have to understand the code too much but basically first of all we have to Let's remove the tile set or the Tom up here let's go to our tiles or pipes now we're going to randomize this in our ready function so first we're going to say set the top pipe and then we're going to create a random variable between 1 and 15 and we do that by saying variable random range top is equal to Randy range 1 to 15 and then we're going to for Loop in range of Randy range top now I'm going to show you another way to for Loop but this is one way and then we're going to do something called set cell this is going to set the cell on our map with a bunch of these numbers now what do these numbers mean well let's take a look so if I say set cell sorry about that we have a bunch of inputs we have layer coordinates Source ID and a bunch of other things now if you want to understand this more in depth again I have a really good video about this on on tile maps that you should definitely check out TI maps are a bit I wouldn't say complicated but a little more advanced and it can get very difficult to wrap your your head around it if this is your first time using it but for the sake of getting this to work we're just going to copy the code over and this will set the bottom two cells and then we're going to set the bottom pipe as well by doing this now in this for Loop we are not saying in range we're just saying in 15 okay we have this code if I play oops I have to play from the pipes I want to check the pipes if this works now how can I do that on the top right there's run current scene this will allow me to run this current scene which is called pipes so if I touch click that we now see this awesome we now have a randomized pipe let's stop and then play again to see if it is randomized it's a little different cool it's very different okay so we see that this works if you would like to try to understand it I would give you kudos for it um however I'm not going to go through the logistics of this again I have a lengthy video about tile maps that explains most of this it's pretty neat and it's uh on isometric tiles as well which is a bonus but it works relatively the same so let's go back to 2D let's go to our pipes we're going to close this for now we're going to go to our parallx background make sure this is selected and we're going to add a new node called timer in this timer what is this timer thing that we just added well it's literally a timer it will just start whenever we want it to in fact there's a property on the right that says auto start I can click on and this will automatically start it when I load this scene now I'm going to explain to you what we want to happen and I want you to give it a try we want to connect a signal from this timer to our parallel background script and then we want to spawn our wall now let's go look at our script and create a function called Funk spawn and I'm going to help you create this function and then I want you to try to spawn them in yourself now in order to spawn something that is from a separate scene I I think it's a little easier than Unity we do something called on ready variable wall or we'll change it to pipe and then we're going to preload it we're going to say preload and then give it the path now what is this path well this is the path of the pipe well I called it wall in my reference but here it's pipe so if I take the pipe that I just created and then I drag it into this preload it will give me the path for it alternatively you can also right click the pipes and there should be copy path control shift C now in our function spawn we're going to do something called variable wall temp and then we're going to create make it equal to the pipe. instantiate and then we're going to say add child because instantiating it doesn't actually add it to our Scene It just creates the object now we're going to add the child into our scene and that is it that is it for the spawn now I can spawn it in the ready function for example let's create let's do this and let's see what we get well there's our first pipe but we want it to keep spawning pipes right so how do we do that well hopefully you figured this out by now but in our node on the top right of our timer we click this and there's a node signal called timeout and you can see here that it's trying to connect it to our bird but we don't want that we want it to connect to our parallx background script so let's connect that to our paralu background script connect it and we're going to call the spawn function when the timer runs out now let's play and see what we get well there we go now we have a bunch of pipes o that's not exactly what I wanted well let's go to our parallx background go to our timer inspect and first of all let's change the weight time now the question is why did the bird not get deleted when I hit it well because let's actually play and I'll show you why we can look to our remote and we go to our world paralex we can see it's we have pipes but then it's adding a bunch of other things that just says tile map so I have 1 2 3 four five whatever well that's not what we want we want to make it equals the pipes so let's go back to our parallx background and we're going to take our wall temp and we can actually take the name which is a property and rename it to something we're going to rename it to pipe now or pipes now this might work let's play and take a look in our remote section doesn't seem to work now why is that the reason why it wasn't working is because in our pipes we were renaming it every time to the same thing but it wouldn't do that because we already had one that existed with the same name so what's an alternative well we're going to use something called in but first of all we're going to create something so in our pipe script we're going to create something called variable wall or uh we'll say yeah we'll say wall now we're going to save this we're going to go to our bird script and in here what we can do is we can say if wall I think it has to be capitalized yeah it has to be the same so let's actually make this lower case and then we'll make this lower case as well we'll say if the wall is in the body then we can Q free now now we can delete this first of all but this is basically checking to see if the property is in that wall that we or the body that we just collided with so let's play and now it should work relatively fine let's test this one more time by going to the second pipe and there we go all right we are almost done we just have a little bit more we're going to create something called a global script now how do we do this well first of all let's create a new script we can we have two options we can either go here right click oh I guess they removed that I think we can go to file and say new script or contrl n or we can go to the res file on the bottom left create new and create new script we're going to create something called game or Global and in this Global we're going to remove all this and say variable point we're going to set it to zero this is the points that our player is going to collect now in our pipes we're going to create an area 2D that is going to ding or give our player a point every time we hit it so let's create this and add a collision shape now how are we going to make this work well it's actually pretty simple we just have to create a long rectangle we're going to move this all the way to the right where the pipe should be and we're going to make it relatively skinny now we're going to go to the area 2D and say if body entered connect this and we'll say if bird inbody body. name because the bird is not a variable but it's the name of our Bird right so now let's go back to our pipe and we're going to say Global do points plus equals 1 however this should error there we go not declared in current scope now how do I make this Global how do I access the script from this script well on the top left we go to our project settings this should open up autoload we go to autoload right here this is where we can autoload or globalize scripts or even scenes so if I click the folder button this guy will pop up and you can see I can actually select the scene too however we're just going to select the global script and open this now it says the path we're going to add it this is the name of the script to access it we're going to close it and this should work should unair sometimes if it doesn't work what we can do is close this and play it again or open it and there we go now in my world we have no way of keeping track of the game points so let's add something let's go to our world and add a label this label is just a label it's basically text so if I go to the inspector and add text I can write a bunch of gibberish but that's not what I want I want to create a script onto this and we're going to say self. text is equal to string because I'll explain it in second global. points because we have to convert this points into a string because this is actually an integer and text is a string we cannot set a string with a integer it has to be a string okay so this should allow us to show how many points we have so let's play and we see on the top left we have the points and every time it pass to the pipe increases the point and if I die it should not increase the point and that's it all right that is pretty much the end of this season series I hope you enjoyed it and I'll see you guys congratulations you have finished this video the mini course if you guys enjoyed this course or little video I made um please subscribe uh share the video with your friends or other Unity developers that have not transitioned yet um what else if you guys liked my content um I'm going to be working on a course coming up soon is going to be a really really big course consisting of not only how to master good D but also game development and getting started in game development um it is not out yet most likely it's going to take me a while to get it out however if you would like to support me on that and my development of that course um I would appreciate it to either support me on patreon or I will have a Kickstarter soon so please subscribe to stay updated on that um also join my Discord which will also be in the link down below again congratulations for finishing this video it was pretty long um hopefully you can continue on with this project and build on it and who knows maybe you can release it probably not because the assets are you know flppy bird but that's okay I hope you enjoyed making your first game in good din this course you'll learn the basics of gdau for game development this course is perfect for Unity developers transitioning to gdau but it will also help people who are new to game development in General Omar Zaki teaches this course he is an experienced game developer and has created many popular good old courses you'll learn how to navigate the interface and build a simple Flappy Bird game hi my name is Omar and I assume most of you guys at least close to the update of this video are here because of unity um a lot of you guys are quitting unity and have decided to pick up gdau and so I have made this video lengthy video it's about an hour long to help you transition into gdau this video is not how to become a game developer it does cover some basic topics of game development however this video is mainly focused on introducing you to the gdau engine not GDOT whatever they say it is gdau um so I hope you enjoy and I hope you learn as much as possible from this video this video definitely will not cover most the nodes it is mainly just how to navigate the interface of gdau and how to actually get started on your project hopefully um your transition from Unity to gdau is not too brutal or if you're not even transitioning your just picking up gdau and want to learn game development this is the right place for you this again is a complete beginner video just how to pick up gdau so I hope you guys enjoy this video and I will see you at the end of the video our first step is going to be to get familiar with the gdau engine and actually making sure we have all the assets we need so here we have our Flappy Bird assets and we also have the goo engine uh executable file so here here was my Z file for that I'm going to delete that I'm going to extract this we have our file here I'm going to delete this we're going to launch the gdau executable we're going to create a new project I'm going to browse it and put it in my desktop going to name this fory bird YouTube tutorial here on the left we have three different kind of renderers now for 2D usually I use compatibility for 3D you would most likely want to use forward and mobile is well for mobile for very less Advanced 3D Graphics um as you can see there's a little uh description of what everything does so let's select none for the Version Control because I'm not going to put this on GitHub I'm going to now create folder because we see here it gives me an error and is telling me to create a folder now I can create an edit and here we have our fresh project project now let's take a look at our interface here on the left we see we have the file system this is where all the files that we create with scripts and scenes and anything else will appear this is also where we will be importing our file soon on the top left we see create node now this will change in a bit however this is where the node structure will generally be this is where I edit and change my scene we can also see the import tab is also on the top left and we have a few other uh settings on the top above that now in the middle as we can see a giant screen we see the project tab this is where we see the actual scene and on the top right above that we can actually change it to 2D now on the right hand side we have inspector node and history this is the inspector but it's also Al the property panel usually so when I change a node or an object in my game the properties will be on the right hand side on the bottom we have a bunch of other useful things as such as output debugger audio animation and Shader editor there's going to be a few other things that might pop up depending on what node you're using for example tile map or tile set can add an extra thing which we will be doing in this video output is usually for things like print which we will also be looking at in a bit all right so at this point we want to actually import all our assets so we're going to minimize the screen like this and we're going to find our folder so here is our Flappy Bird folder assets all we have to do it's really easy we just take it and drag it into our screen if we make sure we select this drag it and put it into our folder it's going to say res we just drag and drop it and it should import now we might instantly see a problem now the first problem we see I'm going to drag one of these pictures onto my screen it's going to turn into a Sprite on the top left here we see the icon for the Sprite and if I select it by clicking it on the right we see that it says Sprite 2D now if if I zoom in we can see it's kind of blurred so in order to fix this we have to change the properties of this now what we can do I believe in texture sorry here we go in the texture property we will go to the filter and select nearest now if I zoom in we can see it has become pixelated however I don't want to do this every time I import and or add a Sprite so we're going to set the default now here by default if we actually reselect this and click the loop it'll say inherit now what does inherit mean inherit is going to inherit the default project settings now if we go to the top left and click project settings or project we see project settings if we click that we'll go to down here we can actually just search up fil filter and we should find rendering Textures in the textures we'll find default texture filter at the moment it is set to linear we want nearest we close this we now see if we zoom in it has become pixelated and the filter on the right did not have to change now the advantage of this is if I delete that and add another uh PNG we can see that it is proper ly pixelated and not blurry well the background is blurry but that's just how the background is so I'm going to delete this and now we have imported out our assets and we have set the project setting now let's go back into our project settings and we're going to actually change the window so let's clear the search we'll go to window display on the left and we're going to actually switch this to divided by 3 and then divide this by three and then we're actually going to switch these so this is going to be 384 and this is going to be 216 so let's make sure we have these and on the stretch we're going to go to the mode and keep it as viewport and then aspect we're going to expand and now we'll close this and now we see that our blue window has changed now this is essentially a camera if I were to play nothing's going to happen cuz we don't even have a scene yet but we'll actually do that right now so let's go to create root node we'll create a 2d scene because we want a 2d game we need a 2d node as the paper what that we draw on essentially this is going to be a piece of paper that we actually draw on and add Sprites and nodes and other things to it so let's contrl s to save I'm going to name this file world and we see that it is saved as a TS CN this stands for scene we also see here that it's going to be recognized as other things but we just need it as tscn we'll save this and now on the left we see world. TCN has been saved and if I click it this opens right it's already open but that's okay now if I click play run project or F5 we can select or select current select we'll open this folder and we can select this to open it and now we see our folder or our screen is right here now if we want to change the actual size of that screen that just appeared we can go back to project settings and instead of switching the viewport and width we're actually going to select advanced settings and here on the bottom below the viewport width I'm going to copy this and here under all the way at the bottom we see window width override now this is going to be overriding the actual screen we see this is essentially the pixel size that we see and play with in our screen so make sure we take a look at the top right here we see that this screen is approximately 250 technically it's 216 that's what we set it to however if we go to the window width override and multiply it by maybe two and then go to the height width override and then multiply this by two we now have these settings and if I click close this did not change however if I click play our screen is now a lot bigger so that's all the override does if you were making a mobile game for example this would not matter because on a mobile game the screen will automatically resize to the Android screen you have or the iOS screen on Windows this matters more because that is the window that we actually play on now I will let you play around with these values do whatever you like but these are the settings I'm going to work with now one additional thing if you accidentally select a different scene to play automatically here we have run project this will play the project completely from scratch from the very first scene now let's create another scene let's create this scene just for the sake of having it so I'll save this as node 2D if I right click this H here we go now we have this that says set as main scene so now if I play it looks the same but it's now going to be running the node 2D instead of the world and I I can actually confirm this by going to the left when I play I See remote and local local is the local things that I edit the remote is the live version here we have root and it also says node 2D we can confirm this by saying by hovering it and it says instance node 2D it shows us the file path now this is because we have set this to play this on the main now I can stop this by clicking this on the top right or by clicking f8 now I'm going to close the node 2D go back to my world and now I'm also going to rename the node 2D to world all right let's get started in actually creating something so the first thing I'm going going to introduce is something called rigid body 2D now in order to add objects into our game unlike Unity or some other engines you might have used everything is already essentially preset now in order to add that specific object you want we go to the top left under scene and click this plus button or contrl a now we have this window that says create new node and all these nodes are essentially objects here we can see the node 2D and it's actually organized quite nicely most the things that are 2D will be under the node 2D if I click this I can see a bunch of 2D objects now instead of just looking through all this I'm just going to use the search bar I'm going to search up rigid body now if I click the X it doesn't select it so I'm GNA actually find it for the sake of introducing just bodies here we go it's in the Collision object 2D so here in the Collision object 2D we see that we have physics body 2D we have static body character body and rigid body 2D now rigid body is used for things like balls or things that need physic uh physics simulation right so I think the classic example is a ball because a lot of engines like to compare those kind of uh physics and I will just say right off the bat if just in case you are from Unity one of the main differences that at least I'm aware of of the rigid body 2D in good and just not even 2D but just rigid body the 3D as well versus Unity is that the rigid body in uh gdau actually Sim simulates a real ball so when you drop a real ball generally it has momentum and it stops eventually whereas in unity the ball will keep bouncing to the same height whereas in goo it'll eventually stop and get to the ground essentially now we're going to create this by selecting the rigid body 2D and create now here on the left we see rigid body 2D but we also have an air on the right now if I hover this it's going to tell us we just need a collision shape so let's do that let's control a or add a node and we're just going to search up Collision shape now we have a lot of collisions we need a collision shape 2D Collision polygon can also work but Collision shape is a little easier so let's add that now let's zoom in to this point because that's where it is we can see it by either hovering or just selecting it in general it's already selected now if I give it a shape on the right I'm going to select a circle shape because my bird is going to be a circle now we can see there's not really anything here so let's add our player so let's go to the left on our files and add our player so we have three birds we can add from I'm going to add the red one we can see that it's automatically turned into a Sprite now in gdau there are quite a few ways to animate things so this gives quite a bit of flexibility in how we want to do things so we can either go to animation here and type in the H frame 4 if we do that it'll take the frames that we had and turn it into this now there's something called animation player which I'm not going to get into but that will it's actually a very powerful tool in gdo that helps us animate various things so if I wanted to animate from 0 1 to 3 for frame it could do that however I'm going to do an E easier method and I'm going to use something called animated Sprite so I'm going to go to my rigid body select my rigid body I'm going to add a node and search up animated Sprite we see animated Sprite 2D let's create here it's basically telling us we need to create a Sprite frame so on the right let's go to Animation Sprite frames new Sprite frames click this and here we have a new selection on the bottom that says Sprite frames now here it says default but I can double click this and rename it to fly now here it's already automatically looped but here we have no frames so let's add some stuff now you could drag and drop but this adds a frame this is frame zero that's not exactly what we want so let's delete that what we want to do is we want to add these four frames into this as separate frames and luckily enough good can do that if we click this rectangle but button little thing we'll find that this pops up and we can find our Sprite that we want to add I'm going to do the blue one actually and if we zoom in by holding control and zoom in able to zoom in and on the right side used to actually be on the top but they changed it so it's on the right I actually don't like that I like it on the top but that's okay we're going to go to horizontal and select one nope sorry four and then vertical we'll do zero or one so now we can select all these and we can see that the numbers actually correlate to the order so if I did this it would be a different order now we can just unselect it all and then select all and it'll do it like that that's probably a bit easier so select all on the top or select none and then select all so make sure we have select all and we add all four frames and now we see all four frames have been added now I can play test this by just clicking this play button and it automatically loops now what I'm going to do is I'm actually going to automatically play this that way it plays on when I play the game now if I run the project nothing is really going to show up so what I'm going to do is I'm actually going to take my rigid body and I'm going to move all of it by instead of clicking and dragging you can see here I've only moved the Sprite what I can do is either there's a lot of options I can either take these two by holding one of them and then shift and selecting the other or control and then I can lock it and now I can select my rigid body or if I don't want to do that which I usually don't I can just select my rigid body I can click this guy the move mode or W and now I can just move the rigid body from anywhere it's a lot easier to move things around now if I play again nothing that's very interesting let's find out what's happen happening most likely it's just falling before we can even see it so let's go to the remote and see what's happening oh I see what's happening we're not playing the correct thing so let's make sure we select this as the main scene and I'm going to delete the other node that I made there we go there's our birdie and as we saw it automatically Falls it has its own built-in physics and gravity that it just automatically Falls we can find it by going to the by selecting the rigid body 2D and going to the right side with the properties panel we see linear and angular velocity we're going to actually play with both of these in our script in a bit so I'm going to unselect those we don't want to select anything here we see the transform this just shows us the position rotation scale and skew skew is actually new in gdau so if you would like to play around with that you can see what it does it's kind of interesting but I'm going to leave it at zero um um we're not going to really play them around with too much so now what we're going to do is we're going to actually add a script to our bird so let's actually rename this to bird then add a script as you might assumed the script is up here on the right or on the left sorry with the little paper thing that says has a plus button if I click that it'll prompt me to attach a note now there's a few options the language I could change before there used to be um don't remember what it was called but it was like another GD thing um but either way you can also I believe import C into gdo um I don't know how to do that I've never tried it I've never done it but there are videos out there that you can find that will allow you to do that if you prefer C over GD script now I will give a not warning but I guess just a general knowledge thing is that GD script is basically python if you know python or if you have an inkling of what python how python works you'll be fine GD script is very similar to python it's essentially the same but GD script just has its own builtin functions which is very useful which we're going to be taking advantage of now we see here the inherits this will actually see what this does in a minute when I create this but what also matters is the template and the built-in script template is actually new which is cool there's no template real template for the bird or the rigid body however for some other nodes there are some templates but either way we're going to leave this as node default for the built-in script this if I select it essentially I cannot find the script in my files it is a built-in script into this node usually that's not what you want to do because if I create this let's create it here we go if I hit control shift f I can find anything in my file so for example let's say rigid it will now show me on the bottom the find rigid and it'll show me the things that have rigid in it now if I had made it built in so let's actually take this out and delete this script if I do the same thing make it built in and let's go to output and then say rigid nothing shows up because it's builtin it's a buil-in script that we cannot search through our files so let's make sure that we have it not built in and create and here we have on the right left as well we have an unsaved thing this is just the the other built-in script it's a little wanky sometimes but we're just going to use this all right so in our script we want to take a look at the code that we have so far because right now it's not much but what's Happening Here is it's going to extend the rigid body 2D which is basically a class which is rigid body 2D that looks like my headset is low but I'll charge that in a minute here we have two functions the ready function it's called when the node enters the scene and we have the process function which is very useful but we're not going to use that just yet we're going to create a new function called function input event this is a function that checks for any sort of event so if I print the event and I go to output on the bottom left and I play my game and I start moving my mouse or even clicking a button on my keyboard anything this is any sort of event now the question becomes how do I specify this to a certain type of thing well I can say if event is input event Mouse button then we'll print the event now this is what this is going to do is if I restart the game it will only take something if I click even if I move my mouse it won't input that because that's not a mouse button it is a motion so if I actually control and left click on this it will go bring me to the input Mouse button um document and I can even click the online document I won't now there's also the search help and we can kind of look at what this stuff has I'm not going to I'm going I already know so I'm going to teach you so when I look in my game let's restart this if I left click we see that the button index is one and the button mask is one and zero that means I click down so if I click down once and then release the button mask is zero if I right click the button index is two so now we can actually check for which button I'm clicking on my mouse and I can do that by saying if event. button index is equal to one so we're taking the event and looking for a property button index is a property of the event so the event here is the thing that I printed so this is the entire event but I only want the button index and I do that by saying button index similarly we can do event Doods or press or anything else you can even check the position by doing event. position okay so now we want to add linear velocity to our player every time I click now how can I do that well there's something called linear velocity however you'll see in a second so if we want to change the Y maybe let's subtract 150 so in Gau when we add or subtract to the Y y AIS the Y AIS is actually negative in the upwards Direction so if I look very closely on the left we can see that this says 50 here and if I go up a little bit this says 50 so I want my bird to go upwards when I click and I do that by subtracting 150 now let's try this oh that's a little weird that's not exactly what I want so what we're going to do is we actually setting it like this is very strange now every node not every node but most nodes have a a builtin function for these type of things now this one is set do linear well set linear velocity to this velocity now I can't just pass through ay I have to give it a vector 2 so Vector 2 is just an x and y coordinate now the X I don't want it to move in the X Direction because that's right and left I only want it to go upwards of 150 now calling self is the same as not calling self so if I do this it's the same as saying self dot I just like to get into the habit of doing self Dot and then the function just so it's a good habit so that way you see what all these things are doing to what right so now we know that we're setting the self to the linear velocity now if I play we can see we have a little bit of jump it's a little better than it used to be now to make this a bit more fun we're going to do the same thing but we're going to say set angular velocity to negative maybe let's change this to negative one and see what that looks like and now you can see our bird is kind of flipping I think I'll keep it tog3 so it's a little quicker now we can see our bird is flipping like that so it looks a little cooler okay we also you also have the option of playing the fly animation only when you click so to do that we can go to our animated Sprite make sure it's selected we have it here on the bottom we're going to turn off the autoplay and we're going to turn off the loop now what we can do is we can take our animated Sprite and drag it into our script and it gives us the path to our script now what does this do this essentially gives us access to the animated Sprite so now what I can do is I can call something from that and I'm going to say play Fly it's going to play this animation for us now we see that there's a bunch of other properties that I could put but I'm just going to leave it as fly this will work fine so now when I play my bird is not doing anything and it's very subtle but now he only plays the fly animation when I click cool all right now we've learned how to animate access animation Sprites we've learned how to change properties now we're going to edit our scene a little bit let's go to our main scene and I want to add something called a parallx background which is up here parallx background we're going to create this and what is this well it's basically a parallx background layer so let's add a another node and we're going to add a parallx layer now let's take a look at how this works if I take my background I'm going to add this one take this background transform it to 1.5 to move it down a little bit and in case you're wondering if you want to turn on or off the GD snap which is useful you can easily do it with shift G or this guy right right here all right so I'm going to move this in the middle and I don't want this to move so I'm going to put it right there Above The Parallax layer now in the layer we're going to add something we're going to add our pipe to see we're just going to add this guy just to test it now you see when I tried adding it it just added it over here in the world we want to move this to be a child of the Parallax layer all right we now have a pretty complicated setup on the left we basically have the parallx layer a child of the world which is fine because we are playing in a 2d world we have the paralic background which is a parent of these two nodes and the parallx layer is what we're going to use to move so let's go to our parallx background and we're going to add a script we're going to have it built in and you don't have to make it built in but that's so it's up to you we're going to edit something in our process function we're going to change the scroll base offsetx and we're going to subtract scroll speed times Delta now what's scroll speed well we have to give we have to give that variable like into existence because it doesn't exist so let's say variable scroll speed is equal to zero now in Gau variables are just called variables now if I want to specify a specific variable to a type here right after I think it's here let's find out together we can say int like this and this will specify that it's an integer now either way it doesn't really matter because gdo is actually smart and will automatically kind of assume what this type is so here when I just say equal to zero it's automatically assuming that it's an integer now this is nice but I'm going to add something called export we're going to to export variable scroll speed now what does this do well if I go back to my 2D scene and I click the parallx background and I look at the properties well now I see it says built-in script and then right below that it says scroll speed and now I can change that to 50 or whatever number you'd like now if I play our background is moving the parallx background is starting to move which is great that's really cool so this is pretty neat one more thing that's usually used in parallx background is called mirroring now if I want the same background to show up I can mirror it by maybe giving it 100 usually you want to give it the same number that is this one so 26 zoom out and now if I play it should duplicate so forget the bird we don't need him have that one that's the second one and there we go there's our third one right even though we didn't draw a third one it is now showing up in our game right and it's going to keep mirroring forever so that's very useful but that's not exactly what we need but it was a good thing to see what this is now let's delete this parallx layer and we're going to add something called a tile map now gdau is actually pretty unique in their tile map because it's really it's a really power ful tool than not many other engines have so in our tile map we see tile set on the right side up here it says empty so we're going to click it and give it a new tile set now on the bottom we have tile set and tile map in tile set this is where the editing happens any sort of editing to my tile map is going to happen here any sort of application that I actually put into my game will happen in the tile map hopefully you understood that if not that's okay we're going to learn this with an example so clicking our tile set on the bottom we're going to take the tile style one because this is the ground and we're going to drag this in we're going to click yes and we're going to scroll down a little bit and we're just going to take a look at here now the do 4 I actually just changed this so it's a little I don't know if you want to call it easier or harder but it's really cool so pay close attention we're going to go to the top right we're going to click tile set on here we're going to click this tile set now this these new properties will show up and we see physics layer and a bunch of other things the only one we're going to focus on right now is physics layer we're going to click add element and this has basically allowed us to create a physics layer so now we're going to unel select that and close this we're going to go back to our tile set because remember if we want to edit anything from our tiles we have to do it in the tile set right so now let's go back to paint actually I'm going to give a quick demonstration as to why we need to do this let's go into our tiles into tile map so make sure we're in tile map and we see tiles here we can select a tile and now we can just draw now okay if you have move mode selected it won't allow you to draw you have to have the select mode selected and now we can see the tiles right there so let's draw along the map and let's maybe put this one now we can also paint or use a rectangle like this to make it a little easier or quicker will make this easier for us now if I play what's going to happen well my player just fell right through that's not what we want we want an actual physics layer now in my tile set again we're going to go back to the tile set we're going to go to paint paint properties and we're going to select the physics layer right here we have physics layer now if we did not create that physics layer you will not see this if you did not see this physics layer please go back you missed a step okay so let's click this physics layer and now we have some things here let's drag the up a little bit so we see everything now here it's actually very neat because we can specify the physics um layer for all of these tiles now I'm just going to select all of these because it doesn't actually matter but for future reference you can actually change these points and change the Collision see that very cool so I'm not going to go too much into detail about tile Maps there are I actually have a relatively good video on tile Maps it's about 23 minutes long and you can check it out is I it's in my channel somewhere you can find it um but um there are a lot of tutorials on to Maps so we're going to just do this and let's play Let's see what we have now bam he hit the floor but we can see that there's a little Gap why is that happening I want you to try to take a guess as to why this is happening so pause the video and try to figure out why there's a little Gap there hopefully you've unpaused well if we scroll down into our bird we see that the physics layer of our bird is this big so it it's working how it should so if we select our Collision map shape we can see here if I try to drag this up and down it's not working very well and that's because we have the grid snap turned on so let's turn that off by clicking shift G or just clicking that and let's pin this down to fit our bird properly cool so now when I play it works as it should awesome all right we now want to add a way to detect if we hit the floor or the pipe in the future so right now we have the tile map called tile map we're going to rename this to walls this is going to represent the walls or the the floor in fact actually I'm just going to rename it to floor I don't know why I renamed it to wall but FL is probably more appropriate now in our bird we're going to add a new node called area 2D so if I add a new node add this node called area 2D and now it's part of our bird and then we need to add a collision shape which we can actually find in the recent as well or you can just search it up whichever one you prefer now we see that it needs a shape so let's actually Zoom in here because this is important when we play with area 2DS with Collision shapes with the actual body or rigid body if this area 2D is smaller than this Collision box or the same size I believe it becomes inapplicable and it basically can't detect anything so you have to make sure the area 2D Collision is bigger than the Collision shape of the actual rigid body okay let's zoom out and now in our area 2D we're going to go to the top right we have inspector and then something called node now node is where all our signals will be there's also something called groups but there are a lot of videos about that and you can check that out groups is uh completely separate from not from signals but we don't have to worry about it right now we're going to focus at the signals in general so let's take a look at what sort of signals exist first of all it's important to note that these signals here are all specific to the area 2D these are built-in signals or functions specific for area 2D now there are other signals that are general for other things like node or canvas item or Collision object or object on the bottom and in fact if we go to our bird and select this bird instead we see there's different signals but these are all the same that's because they all inherit the same type of node now let's go back to our area 2D we want to connect a body entered this will basically look for anything with a physical body you can see you can read it and it says tile map in there so we're going to double click this and if it'll actually automatically prompt us to select this the script of the bird now if it prompts you to select something else we make sure that it's prompting us to send the signal to the bird let's connect connect it now we have this signal so what is a signal what what is this thing well when this bird and the area 2D specifically the area 2D hits anything the signal will proc whenever a b body enters whenever a body enters this area this signal will proc and basically get and say hey something happened right and what do we want to do well first let's print the body let's see what it says let's print the body. name because the name is actually a property so here we renamed it to floor it should print floor if we hit the floor so let's play and see what happens ah so it says floor and bird but why does it say bird well that's because the area 2D actually collided with the Collision shape as well so what we're going to do is we're going to add a if statement that says if the body. name is equal to floor then we're going to Q free this is basically going to delete our player our bird oh there he goes he got deleted cool we have a relatively somewhat working game with no pipes and we can stay alive and it works pretty well and if I hit the floor I die all right so let's start adding some pipes because well this isn't fun without any pipes right so let's take a look at how we're going to add this pipe well I want to actually add a new tile map and in this tile map we're going to go to the tile set new tile set click this go to tile set here and we're going to add whichever pipes you want there's this one I'm going to add this one and there's also this one which you can add I suppose I don't know uh actually I'm going to add the bottom one because I think that's the one I used in my reference so I'm going to go back here and delete this by clicking this and now I have the pipe style actually one more time it should now one thing I will say is you will notice the ID changes and this is important for later but at the moment I'm just going to make sure that the ID is zero to stay consistent okay now we see here that the tile set is a little weird it's a bit different now what we want to do instead is we actually want to change the X and Y texture and we can do that by going down here and typing 32 oh no sorry 32 for the X but 16 for the Y and now we can select this entire thing we also want to do the same thing for the tile size up here so we're going to say click 32 now we can select a tile like this now let's go to tile map and add it we can see that we can actually add a tile right so I can do this can delete it by right clicking let's add a long pipe here that and we can do that and now we have a pipe let's also add a physics layer now I want you to try this remember how we added the physics layer and added the Collision so I want you to pause the video and try this and give it a try P an element tile set we're going to go to paint physics layer we're just going to select all of these you can see here that we can even edit it here I'm not going to care too much about the tiny Collision here like you could do this if you'd like if you are very specific about it I guess I just did that but yeah so you can do that and now the is very specific all right so now we have this tile map that doesn't move right because if I play it just stays there now usually you would think that we want the bird to move forward but what we're actually going to do is we're going to rename this to pipes and then we're actually going to attach a script to this we're going to not make it buil in this time let's create it and in our process function we're just going to add something very simple we're going to say positionx minus equal 60 which is basically speed time Delta now let's go back to our 2D script or 2D scene and play now we see that our pipes are moving it looks like our bird is moving towards the pipe but the pipe is moving towards us and I collide with the pipe now what we can do is go back to our bird and add I want you to try this add a check to see if you can destroy the bird when you hit a pipe pause the video give it a try and unpause when you're done or confused all right so all we're going to do is I'm going to duplicate this and type in pipes now when I play and I hit the pipe my bird goes away cool so in our script we actually want to randomize this now how can we randomize this well I have created a relatively complex script that you probably shouldn't do but I've decided that I'm lazy and I don't know I just like doing it this way so let's um take our pipe and we're going to actually Save branch as scene nope wait yes yeah I was right okay we're going to save the branch of scene and now this thing appeared says open an editor but what is that what does that mean well what we can do now is we can actually take this and delete it now don't worry it's not gone we've actually have it over here now in our pipes we can see that we have our pipes but over here it's not here so first of all we want to be able to spawn in these pipes and then we also want to randomize the Gap essentially now let's look at the randomization first because that's a little lengthy you don't have to understand the code too much but basically first of all we have to Let's remove the tile set or the Tom up here let's go to our tiles or pipes now we're going to randomize this in our ready function so first we're going to say set the top pipe and then we're going to create a random variable between 1 and 15 and we do that by saying variable random range top is equal to Randy range 1 to 15 and then we're going to for Loop in range of Randy range top now I'm going to show you another way to for Loop but this is one way and then we're going to do something called set cell this is going to set the cell on our map with a bunch of these numbers now what do these numbers mean well let's take a look so if I say set cell sorry about that we have a bunch of inputs we have layer coordinates Source ID and a bunch of other things now if you want to understand this more in depth again I have a really good video about this on on tile maps that you should definitely check out TI maps are a bit I wouldn't say complicated but a little more advanced and it can get very difficult to wrap your your head around it if this is your first time using it but for the sake of getting this to work we're just going to copy the code over and this will set the bottom two cells and then we're going to set the bottom pipe as well by doing this now in this for Loop we are not saying in range we're just saying in 15 okay we have this code if I play oops I have to play from the pipes I want to check the pipes if this works now how can I do that on the top right there's run current scene this will allow me to run this current scene which is called pipes so if I touch click that we now see this awesome we now have a randomized pipe let's stop and then play again to see if it is randomized it's a little different cool it's very different okay so we see that this works if you would like to try to understand it I would give you kudos for it um however I'm not going to go through the logistics of this again I have a lengthy video about tile maps that explains most of this it's pretty neat and it's uh on isometric tiles as well which is a bonus but it works relatively the same so let's go back to 2D let's go to our pipes we're going to close this for now we're going to go to our parallx background make sure this is selected and we're going to add a new node called timer in this timer what is this timer thing that we just added well it's literally a timer it will just start whenever we want it to in fact there's a property on the right that says auto start I can click on and this will automatically start it when I load this scene now I'm going to explain to you what we want to happen and I want you to give it a try we want to connect a signal from this timer to our parallel background script and then we want to spawn our wall now let's go look at our script and create a function called Funk spawn and I'm going to help you create this function and then I want you to try to spawn them in yourself now in order to spawn something that is from a separate scene I I think it's a little easier than Unity we do something called on ready variable wall or we'll change it to pipe and then we're going to preload it we're going to say preload and then give it the path now what is this path well this is the path of the pipe well I called it wall in my reference but here it's pipe so if I take the pipe that I just created and then I drag it into this preload it will give me the path for it alternatively you can also right click the pipes and there should be copy path control shift C now in our function spawn we're going to do something called variable wall temp and then we're going to create make it equal to the pipe. instantiate and then we're going to say add child because instantiating it doesn't actually add it to our Scene It just creates the object now we're going to add the child into our scene and that is it that is it for the spawn now I can spawn it in the ready function for example let's create let's do this and let's see what we get well there's our first pipe but we want it to keep spawning pipes right so how do we do that well hopefully you figured this out by now but in our node on the top right of our timer we click this and there's a node signal called timeout and you can see here that it's trying to connect it to our bird but we don't want that we want it to connect to our parallx background script so let's connect that to our paralu background script connect it and we're going to call the spawn function when the timer runs out now let's play and see what we get well there we go now we have a bunch of pipes o that's not exactly what I wanted well let's go to our parallx background go to our timer inspect and first of all let's change the weight time now the question is why did the bird not get deleted when I hit it well because let's actually play and I'll show you why we can look to our remote and we go to our world paralex we can see it's we have pipes but then it's adding a bunch of other things that just says tile map so I have 1 2 3 four five whatever well that's not what we want we want to make it equals the pipes so let's go back to our parallx background and we're going to take our wall temp and we can actually take the name which is a property and rename it to something we're going to rename it to pipe now or pipes now this might work let's play and take a look in our remote section doesn't seem to work now why is that the reason why it wasn't working is because in our pipes we were renaming it every time to the same thing but it wouldn't do that because we already had one that existed with the same name so what's an alternative well we're going to use something called in but first of all we're going to create something so in our pipe script we're going to create something called variable wall or uh we'll say yeah we'll say wall now we're going to save this we're going to go to our bird script and in here what we can do is we can say if wall I think it has to be capitalized yeah it has to be the same so let's actually make this lower case and then we'll make this lower case as well we'll say if the wall is in the body then we can Q free now now we can delete this first of all but this is basically checking to see if the property is in that wall that we or the body that we just collided with so let's play and now it should work relatively fine let's test this one more time by going to the second pipe and there we go all right we are almost done we just have a little bit more we're going to create something called a global script now how do we do this well first of all let's create a new script we can we have two options we can either go here right click oh I guess they removed that I think we can go to file and say new script or contrl n or we can go to the res file on the bottom left create new and create new script we're going to create something called game or Global and in this Global we're going to remove all this and say variable point we're going to set it to zero this is the points that our player is going to collect now in our pipes we're going to create an area 2D that is going to ding or give our player a point every time we hit it so let's create this and add a collision shape now how are we going to make this work well it's actually pretty simple we just have to create a long rectangle we're going to move this all the way to the right where the pipe should be and we're going to make it relatively skinny now we're going to go to the area 2D and say if body entered connect this and we'll say if bird inbody body. name because the bird is not a variable but it's the name of our Bird right so now let's go back to our pipe and we're going to say Global do points plus equals 1 however this should error there we go not declared in current scope now how do I make this Global how do I access the script from this script well on the top left we go to our project settings this should open up autoload we go to autoload right here this is where we can autoload or globalize scripts or even scenes so if I click the folder button this guy will pop up and you can see I can actually select the scene too however we're just going to select the global script and open this now it says the path we're going to add it this is the name of the script to access it we're going to close it and this should work should unair sometimes if it doesn't work what we can do is close this and play it again or open it and there we go now in my world we have no way of keeping track of the game points so let's add something let's go to our world and add a label this label is just a label it's basically text so if I go to the inspector and add text I can write a bunch of gibberish but that's not what I want I want to create a script onto this and we're going to say self. text is equal to string because I'll explain it in second global. points because we have to convert this points into a string because this is actually an integer and text is a string we cannot set a string with a integer it has to be a string okay so this should allow us to show how many points we have so let's play and we see on the top left we have the points and every time it pass to the pipe increases the point and if I die it should not increase the point and that's it all right that is pretty much the end of this season series I hope you enjoyed it and I'll see you guys congratulations you have finished this video the mini course if you guys enjoyed this course or little video I made um please subscribe uh share the video with your friends or other Unity developers that have not transitioned yet um what else if you guys liked my content um I'm going to be working on a course coming up soon is going to be a really really big course consisting of not only how to master good D but also game development and getting started in game development um it is not out yet most likely it's going to take me a while to get it out however if you would like to support me on that and my development of that course um I would appreciate it to either support me on patreon or I will have a Kickstarter soon so please subscribe to stay updated on that um also join my Discord which will also be in the link down below again congratulations for finishing this video it was pretty long um hopefully you can continue on with this project and build on it and who knows maybe you can release it probably not because the assets are you know flppy bird but that's okay I hope you enjoyed making your first game in good d\n"