 Welcome back and let's continue building this clicker game. One of the viewers, Remiator, he proposed me to use timers instead of calculating here the time. So what I'm doing right now in the auto clicker, in the process it's like I'm getting the delta and I'm adding the seconds all the time. So instead of just doing that, there's a node specific for counting the pass of time, which are the timer nodes. Here you have it. OK, so whenever you are adding a new node and you are not sure exactly what it does, you can consult here the help and you can search for the timer node. So here we have it, we open it and here you have an explanation of everything that you can do with this node in particular. It is notated for typing instead of using the visual script, but at least you get an idea of the kind of variables and functions that you have available for using with these kind of nodes. So now that we have the timer node, it will not show up in the scene. It's only for information. Every node that it's white like that doesn't have any representation inside the game. So you can add as many as you want and they are not going to be screwing up your style or anything. So let's go to the main and we're going to be replacing these three nodes, I think. Yeah, even this one, I guess. But let's see. So whenever you have a node like this, you can check the signals and one of the signals that we have here is timeout. Timeout is going to be called every time the timer gets to zero. This time, since the wait time is going to be one, as you can see here, like signals emitted when the timer reaches zero. So if the wait time gets to zero, something can happen. Let's connect this timeout signal to the main, which is where we have our visual scripting code and we have on timer out. So here on process. We can see what we were doing. Here we were setting the second and getting the auto clicker and getting the count and adding them together and then setting the count again. So we do that inside this signal and timer runs out. We get the auto clicker. We get the count. We add them together and operation math add. We want this to and we set the count again. Remember, you can press control. Here you have the tooltip, but if you hold control and you drag it here, it will be a set instead of a get and we set it to this value. We connect it. So now every time it reaches one, it will add these two numbers. To make the timer work, we need to get the auto start and one shot. This will make it to zero. So if you only want this thing to run once, you can set the one shot to on. Okay, let's try it out and see if this works first before trying it out. I'm going to remove this since we don't want... We don't have to check if the variable is bigger than that or anything like that. I think we can remove this. I don't need to add them. We don't need to set it because it will reset instantly. But what we're going to keep is the updating the text on the label. So we can remove this one as well. We don't need Delta for anything now and it's going to be pretty simple. Just getting the count, transforming it to string and getting it there. Okay, so we did a lot of things. Let's save with control S. I can save and let's try it out. Okay, so let's make four auto clickers. So it is working every second getting that. Okay, one cool thing about Godot is that you can hear on the editor on the debug tab. You have two separate settings which will sync the changes that you do in the scene to the game that is running. So if you want to, let's say, test different speeds for the auto clicking, you can set it here. And let's see, five every second or let's see, let's wait maybe 3.6 seconds, two, three, one, two, three. Okay, you see that it changes automatically. If I want to make it super quick, I can set it to 0.5 and it will go up a lot. So you don't have to compile the game all the time to check it, which is really useful. So those are the basics of the timer node. And as you can see, we were able to remove almost everything we have here on this script just for a few nodes on this one. Okay, let's continue with our clicker game. We have the first auto clicker and the regular one. So one of the pillars of the clicker games is that you spend your currency in order to get upgrades. So let's make that the auto clicking will be costing us, I don't know, let's say 10. Like you need to spend 10 to get an auto clicker. And if you don't have 10, you cannot click it and if you cannot click it, it will not happen. So yeah, let's see. First of all, when we have here on the auto clicker, click press, which is the action that happens when you press on the button. Here we are just adding one, but we need to add a check first to see if we actually have 10 in our count variable, which is our resource. And if we have 10, we subtract that from the count. So we want to do the compare. So if it's greater and equal, because it can be the same or more, and we want to get the count. So if the count is greater or equal than, let's see, it's going to be an int, it's going to be 10, which is the price that we want to set for this node. This is going to give us a Boolean. So we can create now a condition. Let's set all this aside. Okay, we move them there. We move room for this one. Let's disconnect this one and connect it to the condition. So now we are checking if the count is bigger than 10. This will happen, which is this one. Moving, moving itself. This is the only annoying part, like moving all the little nodes. Okay, if it's true, we set it. But first, instead of setting it and that's it, let's remove the price. So again, instead of adding, we are subtracting. So let's move this here. Let's get the count again. So we are subtracting an integer 10 from the count and let's set it again. Pressing control, it's right there. Okay, we connect the result. Okay, if it's true, we remove 10 from the count and we add one to the auto clicker. Okay, let's try it out. If I click on auto clicker, nothing happens. I don't have enough. But if I get to 10, I can click here and now I have one auto clicker. And as you can see, I can spend my currency in this button. And I can wait until I have 10 again or even more. And if I spend it now, I have the rest. That is one of the basics of our clicker game. Now let's try to make this a little bit more tidy. We can move actually the conditional here. We can keep all this like the white line at the top. So that way it's easier to follow what the program is doing and all the values that are modifying it, we can keep them at the bottom. And here, since I'm getting the count, I'm getting the count twice, instead of having like two separate nodes, which is fine. Like it makes it easier to read, but you can also use the same one for different nodes. So the getting the count here will be the same as adding another one since we're not modifying it before. And here we'd have the same thing. The auto clicker, you're getting it. I'm not sure exactly if we get it here and we add a number. If this will change when we are displaying it, but we can try it out. So let's try it out right now. I'm not sure if the order of the elements are going to be proper. Let's see. Let's get to 10, and now I can buy. Yeah, I think everything is working as expected. So yeah, I couldn't find any information regarding this. Like I'm not sure if you add this to several nodes, it will execute the get every time you do it. If you do know it, you can leave a comment. But otherwise, it seems to be working just fine. Yeah, we can get this a little bit closer. That's it. We have now this straight line. Another thing that you might want to do to let the user know that you cannot buy it. It's on a button. There's a disable property, which when you click on disable, you see that the button goes like grayed out and you can even style it in a different way. So I want to make it disabled every time I don't have enough to buy a new one. That way it's going to be easier for me to know when I'm playing. So let's go to the process and here in the process, which is the event that happens all the time since we want to be checking all the time because a lot of things can be changing our account. Let's try if the same. Let's try the same if it's greater or equal. Let's get the count. If the count is greater or equal, the type of variable again is an integer. If it's 10. And now we get the conditional. So now if it is, let's use the inspector. It's like the button disabled. We drag and drop it. If it's true, we set it to true. That means that, sorry, the opposite. So if we have enough money to buy that upgrade, which is true, we set it to disable to false. So it's not disabled, which means it's enabled. Now we select the button again. We can drag and drop it again. And now we do the opposite. We set it to true if we don't have enough money. So let's try it out. Okay, if you notice by now, like whenever I play here, when I press this button, it will run the current scene that I have selected. So I always play this, but if you play here, which plays the entire project, you will get the scene that you select on the settings. So since I haven't done that yet, we can do it with selected. And we select the main scene, which is going to be the default one that you execute when you run the executable. Okay, we have disabled here. Let's get to 10 and it gets enabled. So now you know that you can buy it. That's usually like how the clicker games like display this information. We can start clicking and we are starts. We start filling it the addiction. Okay, another thing we should do is as in every clicker game is increase the number that we have here every time we buy an upgrade. So it is not so easy to get a lot of auto clickers. You see right now I can buy even like I can buy as fast as I can click. Yeah, this is that. Okay, can you hear it? Can you hear it? Okay. Can I leave it here for now? And in next one, we can do the upgrading and we can start adding different levels. To do that, what I'm going to create is this button as a separate scene. So instead of having to do all this code manually, you see we are checking here 10. You know, like we have to type this in several different places. We're going to get that information from the node itself. But for now, I think that is it's enough. So thank you for watching. And if you have a suggestion, just feel free to write it down. If you want to help me make more games like this one or tutorials, you can visit my Patreon or subscribe on YouTube, like or follow on Twitter, whatever you prefer. Thanks again and bye.