 Hello and welcome to a new series where we're going to be making a very small game without typing any line of code. Of course we're going to be programming but we're going to be using visual scripting and we're going to make a very simple clicker game. For those of you who don't know clicker games are games where basically the main mechanic is clicking and since our brains are so fucked up that we want to see numbers go up, we will be clicking forever. I don't actually recommend you to try any of the games that I'm showing right now but if you're curious I'm sure that you will find them interesting. Just to make sure, don't ever start playing one of those games if you have something to do because you are probably not going to do it. So let's go ahead and start here an empty project. Let's create with user interface as we're used to in this channel and let's call this main which is the name of this scene, let's save it as main as well. Now that we have this scene ready let's start adding the most important things in clicker games. First of all a button which is going to be the make something. We don't have the theme yet to base this clicker game but let's say let's stay with something and a label which is going to be how many we have off that thing. Pretty simple right? Here we're going to have a number which is going to be going up and every time we click on the button we want to make this number go up. First thing is to create a script and since again we're not going to be writing like typing any code we're going to be using the visual scripting. Let's attach a script and here instead of the language gd script you can select visual scripting. Ok it's main.vs to the name of the file and we have it here. So if you follow my previous videos on graph notes you will see that visual scripting is very similar to that interface and how this work is a little bit weird if you already know how to program but for new people it might be interesting to discover how to create something with it. Here on this new panel you have the name of the files that you have opened so if you have several of them you will have them here I only will be using one for now. Here is the base type of the node which will have some extra properties so if you create this script with the base as the button this will be the button base type and here we have functions variables and signals which are the different kind of sections that we can edit for this particular visual script and here in the available nodes are all the different kind of building blocks that you have to create the logic of whatever you are doing. Let's connect the button here, the node, the press signal which every time you press it it will send a signal to this visual script. It's connected here with main and it's going to be on button pressed. So we have it here we see like a grid you can zoom in, zoom out, make it visible or not if you hide the grid it will be freely there otherwise it will just snap to the grid and you can actually change the size of the grid as well. Here is a function and this will execute a series of nodes which are called like that. Since we are not tracking how many things we have clicked let's create a variable that will store that information. Here if you press plus you get here a new variable and you can double click here and set a name which is going to be the count let's call it like count okay this is going to be our main resource for this clicker game and here you have the any it's on green and very weird to read it means what is the kind of variable that we want to have here and we want to have an integer which is basically a number which will go from zero to a lot. The value is going to be zero and we can close this so now we see that it will change to int I don't know why this is zero still let's see okay it's null right now and sometimes this happens I think it like this feature is still a little bit weird sometimes like I had to set it to one and then back to zero so it refreshes I'm not sure if it will work anyway but just to make sure like I do this we want that every time that we press this button we add one number one value to this count there is a property here in the variables which is export and it makes it very handy for you to use the drag and drop of the program to modify these kind of values so let's go ahead and click on export and that will make it that whenever I select this main node which is the owner of this variable it will have here on the inspector the count and we can modify the value from here so now if I want to change this I can drag and drop this count variable here and here when I select it I have some extra properties now the operation that I want to do is add because I want to add a number which is going to be one so this basically adds one number to this variable and I connected to this node so now every time I push a button it will add a number to this variable okay but we want to display the label information right like we want to show this number on the program because if I run it like this and I press it this is not changing so let's update that label to do that I can click here on the label and here on the text field I can drag and drop it to here so now this will set the text and for the value here that we have the string value we can drag and drop this one to here which will get the value the current value of the count and connect it here so now that we have the value set there we can connect the line the white line and to the last one it's kind of complicated to think it like this but the white line which goes from every triangle to any other triangle is the order in which these things are going to be executed and the dots with colors are the values of those properties in this case the value I set it from the box itself but in this other case the value is being getting updated depending on the count that we have here let's try and see if it works because I'm setting an integer to a string and there are different kind of variables the text variable should be able to convert it but I'm not sure if it's going to happen automatically yeah on properties you want a text of invalid set value one yeah so we need to convert this integer which is a number to a string and how can we make that well here's where we have these nodes the different ones so if you go here and start searching them you will see that there are so many of them so many different kinds of functions but there's a search here that you can type and maybe int let's see to in here string to int so there would be a int to string string let's see construction here string and int so now we convert this value and instead of connecting it there we connect it here so this int is going to be converted into a string and the string is basically any text that we can display and the converted value is going to be updating the label let's try it out again see if this works yeah we can make that number go up and that's the basis of any clicker game okay let's let's do one more thing let's make this new button which is gonna be again here we have the recent ones it's easier just gonna be auto clicking okay and the auto clicking is gonna have another label which is gonna be how many auto clickers we have right now we have zero auto clickers i'm going to start organizing this a little bit better also i'm gonna start using these containers it's gonna be the horizontal box container and let's go ahead and add the button and the label so that way i have in this container both i select this option which will make sure that children are not selectable like the label says right here on the screen and now i can move it anywhere like here maybe okay this is gonna be the auto clickers this is gonna be the button and the label for how many do we have so again it's a new thing to show let's do that every time that we click on the auto clickers it will generate clicks automatically let's create a new function for these auto clicker things let's go on the button on the node and connect it as we did before to the visual script but this time instead of on button press on auto clicker let's rename the name of the function auto clicker pressed and auto clicker pressed yeah so every time we click the auto clicker let's create a new variable for it it is gonna be auto clicker let's edit the variable to be an int let's do the trick for the value it's gonna be zero sorry one and then zero and the same thing but we're gonna do it in a different way here i show you how you can add it with the weird stuff like selecting the export variable and anything like that but here i want to show you how to do it with these same variables so if you drag it and drop it you get the the value only getting it but if you keep pressing control in windows or linux i think it's command on mac and you drag it you get the set so here you can set the value from that and there are infinite ways of setting the value so i want to show you now how to do it with the operations here it is gonna be the math operation add here you have two values and it will return one output so since the output is gonna be what i want to set the clicker let's connect it already and first of all we want to get the current value so we drag and drop it so we get the value for a here if you select the inspector while clicking on this note instead of saying any type that we want to add we want to do an integer so we are adding two integers together value one is the current value value v is gonna be one so we are adding one to the auto clicker variable and we are setting it to that value we connected so this is this should set it the same way as we did before but using different visual nodes now we want to update the label so we will do the same that is going to be the same we drag and drop the text and now we need the conversion which was string and int here so now we convert the value of the auto clicker to the label and we connect it like this okay so here i have the entire thing which is making basically the same that we did in the other node on the other function sorry which is this one but in a more complicated way you can see that there are many different many different paths that you can follow let's try it out see if it works i wasn't clicking yes we are getting the auto clickers going up and yeah when i click on make something the total value goes up as well okay let's now do the auto clicking to work properly we want that every time we have the auto clickers like for every second we add a number to the count here on the functions there's like a drawer button where you can click and you get all the pre-made all the the functions that you have available by default on any node the one that i want to use is process this one as you can read here it will happen all the time so every frame is going to be running through all the logic that i have inside a function and what i want to do there is to now figure out how i can get if a second has passed or any particular amount of time has passed and if it has passed then add the amount of auto clickers to the count number to make it more simple let's create just a second called variable a variable called second we just gonna track how many seconds are passing by second okay and now delta is the time that happens between each frame in a second i believe i could be wrong i'm just i'm not very used to working with delta because in game maker it wasn't incentivized but anyway it should be something like that so what i want to do is add delta to second and since i'm not sure about this and you're gonna find yourself into this situation let's try to do a little bit of debugging or just live coding or whatever with visual scripting which i don't know i think is interesting set the second let's as we did before add operators math add let's see we want to add the delta to the seconds and that's gonna be the new value for the seconds okay so let's connect these options remember if they don't have a white arrow they are not getting executed they are only for values the white arrows is actually the program running and getting from this node to this node to whatever you have okay this should be adding delta every frame to the seconds variable but i want to see how it's happening so let's print it out in the output let's see print this function called print which will get any value and we'll show it to you in the console uh we want to get the seconds again like what are the values of the seconds okay i hope you're getting the idea of how this works but basically function process every frame we add to the seconds like the delta value which is gonna be different every frame but at the end of a second it's gonna be one now that we have it we're gonna display it on the terminal let's try it out okay there's an error okay afloat and anneal because of course this is anneal that's the bug i forgot about so value is gonna be an integer or not afloat float is basically a number with decimals okay so right now second is gonna be let's change this that's a very annoying bug i'm gonna submit that bug right now okay so value is gonna be zero and now we should be working let's try it out again yes you see one two three four five six seven okay it seems like it's going like i intended okay so now we have this thing going up all the time let's squish this a little bit together okay and i'm gonna set i'm gonna be doing that every time this second is bigger than one okay if it's bigger than one it's gonna go back to zero and i'm gonna execute something so every time we get this number you see that it's getting added just by a little bit when we get to one number we do something how can we make that here i guess bigger than no on operators maybe logic it's probably a compare yes a compare okay greater here okay so if we have a number a is greater than b is gonna give us a pooling so what do we want to check we want to check for floats and b is gonna be one which is gonna be our limit and a is gonna be our number so if the second is bigger than one this bool which is true bool it means boolean is gonna be only true or false this will give us true or false depending on if it is bigger or not um oh my god i i hope you're understanding this it's quite complicated to explain it because i have all this in my head but it's hard to put it into a tutorial okay so if you're still with me okay now that we have this if you have these white arrows and you don't know what to connect it to or you want to create a condition of anything you can drag and drop it to the to any empty space and when you release it you will see here like different things that you can do here you have the print that i searched for before and that way just for convenience but now we want to do a condition because the condition is gonna be this one if this one is true this will happen if this one is false this will happen and after everything of this happened you can continue the program from here um what do we want to do now i said to reset the seconds to zero so i keep press control and i drag it which is gonna be set to zero so if it's bigger we set it to zero and if it's not we do nothing okay what happened when we set it to zero well now i want to add all the auto clickers to click so every time a second happens all the auto clicker value is gonna be added to the count so we do the same we do the adding we get the value of the auto clicker we add it to the count and that's gonna be the new value of count so i press control draw it set to count that's gonna be the value so after we set the seconds to zero which means that this will happen every time because we're only checking for one after we set the value to zero we set the count to the name the number of the auto clickers we can remove print because we don't need it and i hope this works let's try it out okay a float what arguments fail a nil okay second is still being nil two hours later okay so after hitting my head against the wall for a while i think i figured out the issue and the issue was here on this step because the game doesn't really like me to set this to other to zero so i went and created an issue on github explaining what i found and this is what you're gonna have to do unfortunately with these kind of features so let's try to modify a few things and let's try to get this to print again sorry for okay let's drag and drop this to the space and do a print to get here the value and see if we are actually adding it correctly like before okay yeah it's being added so now that we know that it's being added uh let's connect this to the condition which is if it's bigger than one do this let's print again after it's done to see if this is resetting like it should be it goes to one and it goes okay let's see let's go back okay it's never one exactly right yeah it's never one exactly because of course this makes it bigger okay so when it's bigger it is doing that it's setting the seconds again back to zero and then the count should be adding the auto clicker okay let's do some auto clickers here let's make five oh yeah but the label is not updating so we actually should be updating this number all the time because if you remember we only update the label if we press on the button here so instead of doing that here let's go ahead and update the label on every process that we have here so every time we run we're running this value we are updating the label so let's go back to the label that we want let's get the text and now let's get the count and let's set oh sorry let's get the count transform it into a string oh transform it into a string and now that we have the string we can connect the process the first thing you're going to do is update the label to get the value and then we can do the second thing okay so when we're having different options different connections and things like that inside one of the same scripts but you want to make it a little bit more organized there is a thing which are comments here you have them and it's a perfect kind of note that you can overlay or underlay I'd say on boxes to make it more like easier to read so this time I want to select all this and the comment for this is going to be updating the count label so we know that all that logic over there it's only going to be updating the count label and we can ignore it because it seems to be fine and the rest is going to be the rest of the script so let's try it now if I click it it's going up and if I have an auto clicker it should be adding one every second two auto clickers to four seconds and if I click it goes up and I think that's it even if we have some issues with it at the beginning and even if it's a little bit more complicated to get to understand these things I haven't touched my keyboard almost at all I can do all this through visual scripting and as you can see here you don't have to write any line of code to get all this to work okay this is this was not planned for the video but I tweeted about my frustration while I was looking for the error and creating the ticket and actually Juan the creator of got out answered that they are planning on rewriting the visual scripting for version 4.0 so I will try to make all my suggestions on time and I will do my best to also help them make this a reality it was just a quick note that I wanted to show here just to make you understand how great the community is and how fast they respond to any kind of feedback that you have so I hope you you so I hope you got a general idea of how visual scripting works and on the next videos I'm going to be adding more options like this to the clicker game and probably the day I don't think it's going to be bigger longer than three videos or so so I will try to get them out quickly if you have any extra question about visual scripting feel free to ask hopefully after I finish this video series I can create a few more issues to github so they can actually improve it and make it work even better and also I think I'm starting to get a few ideas on how to make this a little bit simpler to understand because there's a lot of things design wise that could be better on it but if you don't have any programming experience and you want to start trying things out this is a great way to just dive into a game and start making things also if you want to help me make these videos there's a patreon link and I know that most of you live by now so if you are still there while I'm talking to you right now I'm really really grateful and remember to leave any comment or whatever that you want me to get I read all of them of course and yeah thank you so much again and see you on the next video bye