 Hello and welcome to part five of the ticker game and visual script in tutorial I have a little surprise because I already got the first Animation for the game. I have here the necromancer, which is gonna be in the center of the screen It's gonna be replacing my amazing drawing, but okay when you have an animation with a lot of frames like I have here what you can do is create a new Note which is going to be an animated sprite This will take a lot of textures and animate them when you create it you have here a warning because we don't have any frame or any Inventions selected. So let's go ahead and Create a new sprite frames Now when you create it you click it and it opens a new menu here with all the frames that you want inside this No, I'm gonna move all these brights to my product folder and I drag the folder here. Let's create a new one Sprites And inside sprites a new folder Necromancer, okay Let's paste this animation here when you add files into your project folder and you select go out It will import all the assets that you have there and you will be able to use them here I have all the frames. So I Select them all press shift to select them all and I drag and drop them to the animation so now we have all the frames and Here in the animation node Which is selected I can press on playing and you will see the animation Playing in-game I Want to I want it to be a little bit faster. You can modify the speed here. Let's go with 20 maybe Maybe it's too much 15 Yeah, 15 seems about right. I see that there are like a few frames maybe extra at the end You can order the frames here and and delete them move them. See if I remove the last one It's like this one and press here Maybe another one Yeah, this seems more smooth okay, I can place it in the middle of the screen and Yeah, maybe a little bit slower. Let's go with 10 12 Yeah, 12 seems about right Okay, let's save it. Let's try it out And yeah, we are starting to have a game. I want to have different animations for this but I need to Ask my brother to make them Do you want to check he has a YouTube channel you can check the link in the description It's really really really interesting if you check it out next is going to be Translating some of the code that we have on the game I want to do a quick demonstration of how it will look like to translate some existing visual scripting code into Just regular script. So since the Main script, I feel it's the most basic one. I'm gonna do that one Right now You don't have three variables and two functions So let's create a new script here. Maybe Yeah, right-click new script and let's create the new script but instead of selecting the visual script Let's go with GD script New script that GD. Okay Let's rename it. Sorry, let's call it main Now we have Main GD main vs. Okay, so let's open it we can delete everything and And start with the first one this one on boot and press this is a signal So we need to connect the signal again to this script and to do that I'm going to select the main node which currently has the main script that vs selected you can either press here and select a new one which will delete it or load a new script and Select a new main that GD Now that we have the main that GD we select the button which was this one The one that when you press it it gets one more And here's the signal we had let's disconnect it And select it again connect again to the main node So now inside this main script we have the button press Which is the same as this function What else do we need? We need the process function. The process function is a function that you have pre-made You don't have to connect any signal to it. So we can just type it underscore process Delta Okay So we have both functions now and how many variables we have we have three variables Two ints and a float auto clicker count and second so We create here our auto clicker Which are the values zero zero and 0.01 I don't think we're using the seconds anymore, right? This is from Something we already deleted. So we're not gonna move that one to the new one We are using count. So let's go and count Okay Let's check more properties here. Are they an exported variable? No, they're not and count Yes count it is exported Let's see How how do you export a variable here in the same way that you click there? Remember export variables are the ones that you can edit here from the inspector To export a variable you just type export in front of it And that's it. You don't need to do anything else That way when we select count we see here that it's zero well Now since I'm using visual scripting in other places and I feel like I'm getting the the count Yes on a different scene I'm not sure if I if this node will work Uh, if it doesn't work, we're gonna have to also translate all of this But first let's continue with this translation What we did in the process function was updating the label This label which is the one that displays how many points we already have So we need to get the count Make it a string and set the text of that node To do that we can use the get underscore node and type what node we want to Select this case is the label one Or we can use the dollar sign And type the name of the node that we want Now the function to set the text is called the same as in visual scripting set text But here is all in lowercase like this or You can even set the variable text And equals whatever you like This case we want to transform the count. Remember it was like a number. We want to make it a string We do as str and Count which is the name of the variable we want to translate So This line Would be doing the same as all these three boxes in visual scripting Now for on button press What we did was Let's see We add one and we updated the label as well We don't really need to do this because updating the label is something we do on every step of the process Like this function will be running constantly as the game is running. So we can just on button press Count Plus equals this will add to the existing value of one And that's it. That would be the same functionality we had in visual scripting, but with regular gd script Let's save it. Let's try it out. I'm sure it's not gonna work Oh, well. Yeah, it is working. I'm not sure if the references are working Yes references seem to keep working Well, that's good news because That means that you can translate only part of your program and it will still be working Now let's go and close This visual script we don't need it anymore Let's delete it to make sure we don't have any any additional file around and we need to translate the auto clickers. This seems a bit more complicated But in reality is quite simple. We should be able to do this in a couple lines, of course Let's see what we have in total. We have Few variables And three functions So let's start with the same Let's open up the auto clicker Here we have it The button the labels and everything. Let's remove the script We don't want it anymore You can press here on clear or the button there Now that we don't have the script we create a new one It's going to be a gd script auto clickers in that gd We create it We delete everything So now we need to connect the signals. We have one signal for the timer one signal for the button Let's disconnect it and connect it again to the auto clickers node And for the timer the timeout function, let's disconnect it and connect it again to the main node Okay, we also have the process function. Let's create it Now variables we have The amount increment price price string and ups I remember I wanted to replace this price string stuff So I'm not going to copy that one. Let's do amount increment price and ups Which was units per second, I guess. Yeah amount is zero then two then five then one zero two five And zero again, I guess units per second One, okay Now which of these variables were being exported amount? No Increment no price. It's been exported And units per seconds are exported. So Okay, these are all exported Now in the process function, we have all these things timer timeout, okay and button press Let's start with the timeout Let's see. What do we have here on timeout? We get the count We get the units per second. We multiply them Okay, so amounts per Units per second and we set it to count. So we know that we want to set count So on timeout count will be at sequel and This count is the one that we have on the root node on the main scene. So get the tree and then get node And the name of that node Is main With capital letters, okay Let's see if this is working. Let's print it out Oh, I forgot about here. We also need to get root Okay, this should be right. Let's try it out again Yeah, yeah, it's it's working now. It should be one. Yes Okay so We can actually Store all this reference In a variable so we don't have to call it every time Let's create a new variable, which is going to be main node And in in a new function, which is going to be called at the beginning Of the game which is ready I'm going to assign the main node to this So now I can reference the main node by just using main node that count This is I feel the only thing that it's a bit more complicated than the drag and drop that we did before to get the count variable But if you know a better way of doing it, please leave a comment It's not as complicated as having all that mess of boxes around. Uh, let's continue We already have the count. So we needed to get the amount and the units per second amount multiplied per units per second and Added to The count that we had so instead of just Saying this is going to be equal. We just want to add it Amount with a t. Okay so this line is basically doing all this And this line is kind of a way of doing this And yeah, you see how easy it is to do something like this with text Now with the button press. Let's see what we have here Okay, let's go part by part We start the program here We get a condition Okay, what is the condition? If the price is bigger or equal than The the amount the count that we have on the program so If the price is bigger or equal than the main node count So we already have all this covered Let's see if it is true we add No, we subtract the price. So yeah In the main node Count minus equal price Okay So we have this done Then we continue to set amount So we get the amount and we add one Okay So amount We add one So what we're doing with these two Now We set the text Okay It's going to be this text, right? or Yeah units per second or this label Uh, okay Okay, we set the text the label text, okay So remember the dollar sign label Text is going to be The amount Okay, pretty simple We transform it to string And we update that label What else do we do here? We continue to price Now we get the amount and the increment and we multiply it together So Price We get the amount Multiply per the increment And that result we multiply it by the price Okay, so let's add some parentheses So we know that this is going to be multiplied by the price And that's going to be the new price Okay, so this should be all done I hope I didn't make any mistake, but this seems about right We check if the price is bigger or equal than the currency that we have We subtract it We add that we have a new one We update the label To display that we already have one And we augment the price By multiplying how many we have by the increment And by the price So we already have button press Timer timeout And now let's go for process Let's see what we do here in process Okay, we have a first First a conditional To set disable the button or not Okay, what are we checking? We're checking the count If the count is bigger or equal than the price So let's go If the main node Count is bigger or equal than the price So let's go If the main node Count is bigger Count is bigger Or equal than the price We select the button And Disable Is equal to false Because that means that we have money to buy it And we want to make the button available Then If it's not We disable it Else Button disable it True Okay We have all this part ready All this Yeah Goodbye Now we need to set the text Which text? Let's see the price text we are modifying So we get the string We get the Weird part that we We can make it better But okay Let's see We set the price It was still one Right, yeah, okay So We select the price Node, which is the label We set the text equal to Price Equal to space And now we add The price Value Okay After updating the price We update the units per second Which is The HP contact value Okay, this node Now HPost Here For container value Text equal to the UPS Yes, UPS Units per second And that is the process function There I don't think there's anything else I should be updating Right, let's save it Let's open this main scene Let's save it again I'm not sure if these values are being, yeah Yeah, okay This is the script Let's remove this one just in case I don't want to have it Going around Autoclickers.vs Delete And the moment of truth Let's try it out Okay, we have here Value, yeah, I forgot To transform this into a string My bad Okay, let's go again And yeah, we have different prices Let's see When I have This is if I cannot buy it If I have this Price went up I'm getting one unit per second Yeah Oh, I cannot buy this one Okay, so there are Some problems Here and there That I must fix The first one is that The prices are not updated properly And maybe this number is not Being Let's see what I did wrong Let's go again Through all of it Let's see Oh, yeah, yeah, here I'm checking if the price is bigger Than the amount we have This should be like here If the count is bigger Than the Price of this item itself Okay, this should fix Everything Let's go And Let's buy this one We're generating units by units per second Now I can buy all the upgrades Yeah, okay So Now we have the program With no visual scripting So From now on This is going to be Only working with GD script And I'm going to make I'm not sure if I'm going to keep making Many, many more videos Because my brother is very busy And the rest for this Game would be adding More graphics and effects Things like that And I need him to make these amazing Graphics that we have here But on my next video I think I can make A better style for the buttons And Designing it a little bit better So when, you know, like the style Of the buttons and How the information is laid out I think I can make a quick update On that Okay, that's it for today If you want to help me make more of these videos There's a link to my Patreon on the description And I want to really thank my Patreons For everything You guys are amazing And for everyone that has been Comments on the comments Or on Twitter or Reddit Please keep them coming I'd like to know what you guys want to learn And yeah, that's it Bye