Godot Engine Meeting the Nodes 1 Node Part 1

producers welcome to this tutorial it's called meeting the notes this will be the first one the idea is that you can understand about the different notes in go out and learn how to use them more efficiently the first one will be just the note remember to click here in the sync tab you can see all the notes that you can instance in your is you've seen the route one on the bass one is a note which is created in coded different to other game engines and notice just a note it doesn't have anything in special no transform information like rotation and translation it just a note because as you see it can have children and get her it can have parents and that's about it so well let's see what it can be done with an old here you can see the properties of this note there's nothing much just a pulse mode and the script I think one of the things you want to know is how to script it so this is the first thing we will do if you look here at the top of the scene tab you can see a few icons you can create a script here but it's kind of a lot of steps so you have this button here which is faster it brings up a wizard for greeting script before creating it it's recommended that you save the scene like for example and then when you create the script if it's in route no it's going to be name just like your scene this top G be it inner it's the node class and then it's a test then we create it as you can see this is the script let's explain a bit what you can do with the script the first thing is this ready function that comes preset this is it's important to tell that this is not really a constructor that you will see in other languages the constructor in this scripting languages in it it's it's this this is what's called one the notes created but you generally don't want this because what you want is when the note is created you want to access all the sub notes and your entire scene so the ready function is called when the note and all the sub notes enter into the active sentry in the scene free you can see all the notes that are working when you remove them they stop being active every time the note the note enters the scene the the function really will be called so what else can we do in an old remember that in garage you have the full built-in documentation you can search for the class know then you can see all the documentation of the functions you see the truth functions here that work for for just other writing stuff I think the main things you can override here are the process function which is the most common one I think the first most common one you can own right process you can see the internal pressure is going to complete this this is called every frame and the oldest till is telling you the time that happened and that passed since the previous frame this function is not going to be called by default if we if we want to know about process and get it get Cody call every frame you have to set it active like this and now you will get this function called every frame there are important functions input' and you will get this function call every time there is an event from keyboard mouse just takes everything again so these functions work you that you have to enable this with this here you can enable processing of input and you will get input events you can check the event type for example it would have to complete as you see this we get : the use of press the left mouse button you will get this code so these are two main things you can even using in a note it it works for every note seen there are seen heritance and this is something else we can do for example will we create another node this is another note and will create another screen for this note with this again as you see this is not the root no so it will ask you for another squid pad for example we can do this there we go we have another script each note has a script okay let's see you want to access they both have a scribe you want to access these null we're going to give it some name like charlie just because and then we will have a function and we can have a variable if you wish so imagine you are here in this screen in this node which is the base node and you want to access the function from from these other nodes it's very easy you just use the get node function just call the node you will see how to compression for everything so you get the know charlie and then you can call the hello function as you can see it's really just go it as if it was like a regular code if you want to change the variable like increment the hellos just like this as you can see it's very easy to communicate between scripts in different node single dot so one last thing let's just explain what the path is we have seen it before but I haven't explained it as you can see every node has pause mode which is Henry to stop and process by default it's in here it this means that the behavior will be the same as a parent node so if you want to pause a game and you want to just pause it what's going to happen is that the process and input functions will not get cold anymore you mean that I mean the nose count not going to work any longer when when posting will not get either input or processing but if you want this node to work while the game is paused you just change these two to process so in pulse mode is going to process this is basically what happens when the game is paused so just change it to this and this this will be called again this is useful because you can pause the entire game but leave a few menus that still work when the game is paused well on the last function that you will see today is the notification this is a little lower level but it's interesting to know that it exists this you can all right - and so what is notification let's check on the search help the classs known as you can see there is this list of content constants in every node which is like an to create seek removal power fix's process process every every kind of event gets a notification and you know this is events for your same note things that are happening to these note okay as you see nothing here is object and objects has a few more notifications of itself like posting utilized after it was created this cut call before it's going to be related strike up the structure but not really and these are the two notifications when you work with notes just make sure to check your notifications maybe there something you care about it but in most cases you will find a virtual function that does what you want without having to use the notification system just good to know that it's ER well this has been everything for today thank you for listening and good bye

Loading