Godot Engine Meeting the Nodes 2 Node Part 2

you oh and welcome to the second part of meeting the note this time we will learn a little more about note if you remember the previous tutorial we have just created an old just single note like this we will see three more things about it the first one is signals every node has signals that are just like notifications that something has happened is like call back but it just happens and you know about it when you press this button here you can see the list of signals for this note for example that Eddie enter the scene 3 exit the scene 3 it was free name or the script has changed for another strip there are our notes for example rigid body you can check that it has different kind of signals like related to collisions with another body you can for example clicking with your mouse and it's going to record the input event it will tell you when the mouse enters and exits that we rigid body in the screen since this heanor its canvas item which way we will see it later but it control it and hide it has visual stuff and then you can see the ones we have seen before which is entering traits to create not rename exactly et cetera so what is the nice thing with signals is that you don't have to pull for things to happen when you start making games one usual mistake is in a you make a loop and then you start pulling for things like needed collide is the mouse inside the area of the of the object and things like that with signals we just know when something happens we are being told that something happened at the time it happens so you don't have to write any code that constantly checks for this condition and it's really easy to use let's just save the scene and then let's create a script when you connect to assign girl you just connect this I know you press connect you can choose to which node you want to connect this angle to you can see in read the note that is currently selected but you generally connect the signal to a scrape or a note that has a script so you just in this case select null which is the know that half the script and you have the option for making a function which does this when you connect here you can see when the node enters the scene free this function will recover and the connection already is done as you can see here you have just connected this and then the function will will automatically appear and because when this cycle happens so what else can we do with null besides signals something interesting is the encoder is that you can use groups to group your nose for example you you press this here the button with the two balloons you can see a list of rock groups in general it's empty because circular does not do scrubs much internally just for example you can have the group Charlie's and you know that the notice is in that group how to get or do anything with the groups well we can check in the note it is in a group like you call the position is in group not very useful you can get all the notes in a group by doing get free cannelton group surely this will return an array of notes in that group or you can call a function in that group here you call the function hello to all the notes of that of group charlie it's just cool for organizing yourself for example the enemies if you something happens and you want to kill all the enemies you just call the function in all the nodes in the group enemies so it's quite handy ok so what is the scene 3 we I will explain what the scene 3 doors in general lines it does a few things sing crees like an object floating in space you can access it using the get free function from any node you just call get free and you get the same tree why does it get sink reads an object that does all the scene management it can like contain the tree of nodes it can change your scene it can do probe management everything that is a global to the scene is done by the scene 3 object let me look for it this so we can see here that we have a few group management functions like notified groups a group get notes in rope it can do scene management here you can see the function for changing the scene you have loaded the scene when the game starts and you can change it for another one this is a very simple scene change it will instantly change the scene you can do more complex things like background loading and things like that but this is for more advanced tutorials it can also do passing of the game you just use the set post function and the game will be post as we have seen in the previous tutorial and you can unpause it from calling the same function also and most importantly you can get the root node of your scene you can get the root node and at all the notes you have used for for loading the scene will be the this note here is going to be a child of Road note just showing a bit how it is used for example if you want to to change the senior you call get free and change seen here you have the code that changed the tips into another one you can I get the all the notes in a group this returns like an array the Charlie the Charlie group you can get all the notes in this group you can pause the game you get free here you pause the game and finally we come change the channel sorry we come get your root node you just call root and this is the root node you can free it if you want hi but that's not very useful okay well this has been everything related to this entry I hope this was useful for you goodbye

Loading