 Hello guys, what is up? It's crypto grounds here, and I am back with another video This one's gonna be a little different than my normal tutorial series. I kind of wanted to get break from that This is gonna be either a really long video or just a series, but we'll see how it turns out I just created a new I Think it's called Kofi or Kofi website. So if you want to support me Here's the link right here $3 or more Anything would have I would really appreciate it. But yeah, here it is so this video is going to be about Making a sort of a click a hero's game I had a request and I was like, oh, why not do it? This would be pretty basic idea so I'll be going off my English project that I made in the past called Beowulf incremental it if you've watched my entire Tutorial series and you should be able to follow along pretty easily So the things I won't be covering in this is how to make the pixel art I mean, I'm just gonna use my current presets that I already have I'm not going to use break infinity. I'm just gonna use the classic floats doubles integers stuff like that Um What am I what else what else what else? Oh, yeah I'm not gonna do like any like special animations or anything in this game There are animations, but I'm not gonna do that just because there's a lot of tutorials I really feel like I don't need to cover that But yeah, I'm making the general the general mechanics and using the same sprites and stuff like that And Yeah, and I'll and also I'll be showing you how to do the stage system too, which is it's actually fairly easy It may seem really difficult, but it's actually not that bad Okay, so I'm gonna play the gamer click. I haven't touched this in a year. So we'll cross I'm crossing my fingers. Oh, so work Yes, okay Here let's play a full screen So I'm just gonna play not talk for a little bit Just so you guys can get see what the game will kind of look like see we progress to the new state the next stage We could buy some upgrades here. Oh, this is supposed to be hidden This is um, this is the not updated version. There's a little bit stuff. That's not included I'll also show a simple rebirth as well and You guys should be able to follow that one if you've watched my tutorial series This is supposed to be damage proceed. I fixed it in my updated version. This is not updated And this actually took me like a week or two to make It's really simple But it works Now I really don't want to click all this so I'm just gonna go to my game controller and just give you some money All right. I max by max by max awesome. Oh Yeah, I have a boss. This is supposed to show up as like a bicep boss icon, but it's not I Fixed it in my updated version. I know I'm referring to it a lot, but that's actually true So yeah, and Every boss we defeat we get Gemstones so we can restart and now you have three gemstones each of them gives a 10% So we have a 30 cent percent boost so far All right, so that's all I'm gonna show you that's pretty much how the game worked and Let's jump right into it. Oh and another thing before I get into it is that I'm gonna show you how to Oh, yeah, sorry I'm not going to go in depth on explain what everything is because I already do that my tutorial series So if you haven't watched it and you've never coded C sharp before I've really high command you highly recommend You watch that series before you do this because I'm a go kind of fast as in just a lot of typing and you guys follow along All right, so I'm gonna make the game real quick I'm just gonna create a new scene. I can use my the same stuff. Okay, so we have made our new scene I'm gonna use Not free aspect. I'm gonna create my own resolution assuming you guys want to do it for your Computer so I'm gonna do Or 2080 by 720 as our base resolution we could choose 16 by 9 that works too Okay, so like usual we're gonna create our UI canvas And we're gonna set it up scale with screen size I'm gonna do I Do oh I I can't okay. I was thinking we'll be able to do a ratio, but you can't so I'm gonna type in my default and We should be good. All right, so before we continue on save this scenes tutorial All right So set up So I already have some text in here, so I'm just gonna use the one that I already use I forgot which one it is But I should probably make this bigger and I'm gonna add a background too So I'm gonna use the one that I already have I have no idea what this background is, but I'm just gonna use it actually I really want to stay on topics so Let's use This one with some effects just make it darker so you can actually see the game Okay, we don't really need to go super detailed into this This is just about the making the game in general making it work, so Let's do I'm just gonna use this one So this will be our money So you have zero dollars We're gonna anchor it to the top and this background needs to be anchored stretched around the canvas Let's rename it money PG Okay, so now we need to have a few other texts, so let's add UI image This is why I like about sliced Pictures is that you can change the size of them. That's super super convenient So now I can make it smaller just like this Let's make this one the stage I'm gonna put a text inside Add this text. I know this theme is pretty horrible, but We're just gonna wing it. It's supposed to be a semi-quick tutorial Let's make this 25. So this is gonna be a stage one This might this could probably be like black All right, so we have one that's gonna anchor to the top as well and Here will be the kills and this one will be Dpc damage per click and make those small a little smaller 20 Okay, so we have our basic setup right here and now we need we need to have a target So we're gonna make this our enemy. She's gonna make it about You can make it whatever size you want, but I'm gonna make mine right in the middle 300 by 300. I'm gonna add a sprite to this Let's do. Oh, it's destiny We're gonna do what's a good one This is a good one. We'll use this one. It's you can see it very easily so We need to add An empty. This is gonna be our game controller We're gonna script called game controller as well Create an ad and we're gonna add two more buttons real quick. I'm just getting the whole setup ready I know I'm a little bit out of like I'm just going. We're gonna do this. We're gonna do that. Yeah, I know I'm well aware We can add a backstage, but I really I You know what we're gonna do it Yeah, we're gonna add a backstage and a forward stage. I don't have any icons for that So Let's just make that a button. This is gonna be our back. That's very small Or very big. It's very big Okay, so that's our back and this is our forward Yeah, it's got some bonus content. Woohoo, this can be a negative This is with 5.14. All right So we have our text Mmm. I hate doing this part When you create a new text and it's always set as default that is very annoying. I Don't know if you can change the default text. It's layout But if you can that would be a miracle. We'll call this one back and This will be forward So this is to flip stages This will be shown if you go back and Back will be shown if greater than if the stage is greater than one Okay, I think we are good. We are in a good position to start. So let's open up our game controller So I may be coding really fast, but all you need to do is follow along if you know what you're doing Or if you understand how the code works So we're gonna have a using dot unity engine dot UI We can get rid of this stuff just because I like to format it by myself So let's take a minute. Let's split it in half So what do we have here? So we have quite a few things. We have a public text Okay We have another text. We have a damage per click Public text TPC text We also have a stage text stage text Public and we also have a kills text kills text I tend to have these lowercase even the abbreviations Um, that's it Oh, we have two buttons as well. So we're gonna make those game objects The uh Sure, we can make them buttons. So we have back public button You can make them more descriptive if you want. I'm just going by really fast. That's my goal And we need a public void start Uh before we go into the methods we need to have our variables. What is um, What do we use at these two? So we have a public Ah, I can't use big double forgot. So public double money public double DPC public double Uh this can be an int int stage public int kills public int kills max so um We're gonna start with our public void update rather than our Uh our start because we don't really need to start with anything right now actually we do so This is gonna be a new concept for you guys, but I'm gonna do something this that's we're gonna make a setter so Okay, yeah, that works. So we're gonna do this. We're gonna set this We're gonna make an like a little method inside where it's called a setter We're gonna set this automatically to one because of this Is it because I need this? am I Let's check my code This is my own code public gif Yeah, that should be right That is very odd Oh, is that it? Ah, I see now This has got to be right This is a little awkward Uh, I don't know what I'm doing wrong. Oh, that's right This is a get this is a set. Okay Never and I'm stupid So this is a getter. So basically whenever this variable is accessed. It's gonna be one regardless of what and It can also be set to anything If you want it to But for now, we're just gonna keep it as one. You know what? This is actually a really bad idea. This is too complicated So we're just gonna stick with the public void start It was one. All right. This is uh, this is going all right So we're gonna have our text display some stuff Money plus money And the thing in here is I'm also not going to show you save systems as well I really don't want to get into that just because it takes a little bit of time and You guys can watch my tutorials if you want to learn how to migrate all that stuff all like ditty I like to show two decimals whenever I have a double just because that's just common sense All right, so Well the text we need to send Dbc plus Damage per click You can abbreviate that got text Um So stage Stage And kills will equal Ah, right easy. This is just kills slash plus slash Plus kills max done. We're done with that Um, we can have a progress bar if you really want to but I think you guys would figure that out pretty easily um If you guys watch my tutorials Um, so another thing I want to add real quick is a it's a health bar just because We love the help. We love the progress bars So this is going to be a pretty straightforward one. So we're just going to go to canvas ui image This is going to be called our health bar. Um, so I actually have a sprite for that This one Perfect. I love this. Um, we're going to create an image inside as well Do I have a progress bar for that? No, I don't So what I did is this was actually kind of a little difficult I had to put this Okay, so I had to flip this this was this is going to be a little weird So this is actually going to be the health bar Inside of the progress bar Really crazy. I know It's amazing. It's good stuff but Um, oh, that's why I have this white in order to get a progress bar. You need a white It's a plain white image Then you can make this filled Um horizontal there you go So we needed to change the size of this as well Just so it matches I don't like this part All right, this should be good. So now we have our progress bar. Oh, right So this is the bar the health bar This is the health border I'm just being fancy here. So you do it how you want to do Right. We forgot one more thing This is this is actually going to be green You can make this Whatever green you want Maybe like that. Okay, that looks good. And we need a background White image I'm sorry This is This is actually going to be the health bg. So everything's just reversed because of how I did it usually would be the The bar is over the background. So the bg is inside the bar, right? Resize as needed Oops, I don't know what that was Okay, so now we have our lovely progress bar or our health Before we continue we need to have our text We're going to indicate the health Zero out of 10 HP So that's that's all we need to see what you guys say, right? This is a little blurry, that's okay Uh, we're just gonna make that black back the the progress bar is actually made of red And then the background is going to be green So it looks like this Boom done. All right, so we got that coming So we have another text and another double so public double health and we also have um a public text health Or yeah public text health text and our text is going to be oh, we need one more health cap the It's going to be indicated the same as this this being a health And this being the cap Oh plus HP and for here we need to add plus kills All right So we have that and we're gonna need to do something with these two buttons So We're gonna make a if Stage it's greater than one Stage starts at one Stage always starts at one if stage is greater than one Then this Back button dot game object set active Is true And we can actually move this to here um else This game object Is false you can't see it. Um, okay, so now for the forward button So if So we're gonna have a new int stage max to show your highest sage if stage equals Is equal to stage? max Or how about is not equal to stage max Then the forward button is visible Otherwise It's false. We can't see it Um, that's it for that to code wise We're gonna make some two methods real quick. I know we're really far ahead of making the gameplay We're already jumping straight into the back and forth method very bad idea, but that's just how my brain Thought this video was gonna go not not how I planned it, but sure we're gonna do it anyways so public void back Is gonna be if stage greater than one Sage minus equals one and The same applies to forward. These are really easy methods. We can actually move this here Just to make everything a lot easier to see forward If stage is not equals to greater max then you can move forward Done we got those methods done and over with And now we're gonna add the basic Void hit button. We're gonna. Ah, no, that's not what I wanted to do We're gonna do hit the hit the enemy So health Minus equals dpc If health is greater than or equal thing health cap Then we are going to Reward the person We're gonna add one money We're going to reset the health equals health cap And going forward But we're gonna add one more um, oh wait, we have to add kills kills plus equals one if kills is greater than equal then Kills max which is always gonna be 10 unless you add some special upgrades But that's a good variable to have unless you want to adjust it If kills is greater than or equal then kills max Then we are going to um We're going to reset the kills It's zero And we are going to add a stage We're going to add a stage max so we continue progressing through the game Oh another thing before we forget about this if Stage equals stage max because we don't want to add we don't want to add kills to a previous stage That just doesn't make sense, right? So we only want to do this if we are at the maximum stage possible, right? But no matter what if we get a kill we will Get this oh and this should be health should be Less than or equal then because we're subtracting health right now adding on So that should be I honestly think we got the general mechanics in Let's let's try it That's it Obviously I could add upgrades But that could be an an additional video Um, let's try to put everything together. So we have our dpc So let's put that above just because everything's laid out that way The controller should always be at the top So you can access it easily and stage text kills text Health ah, I already see we forgot something That's okay Hmm. These aren't buttons, right? So we have button here Button here So we're going to add to both of these we're going to add we're going to create new We're going to add our game controller object here We are going to select backed method for the back button and the forward method to the forward button Alrighty and we need to add a note here same thing here. So game controller here We are going to add a hit Um, yeah, so What's wrong here? So these aren't buttons, right? These are game objects. So we simply can just change the forward Ah shoot game object. We can change these buttons to game objects and that will fix our problem These become game objects boom. We are good back Forward save let's roll. It's rock and roll Oh another thing So forward is still being displayed it shouldn't be So we need to set the stage max to one We need to set our health Health max to 10 health Will always be equal to health. We can just set at the 10, but i'm just gonna Just gonna do that. Oh, it's health cap. Um, what else did you forget? Oh, yeah, we forgot an image public image health bar And right below the health text we're gonna do Health bar fill amounts equals health divided by health cap And that's not gonna work because we need to cast as a float. These are double variables and the fill amount is a float So we need to Shoot what what I do We need to cast it by doing this automatically sets it to float If anything is if this gets bigger than the maximum float it will freeze your game And you'll have to find some method to ignore that such as Making sure the decimal is never less than or Never really less than equal to a certain number like point in zero zero one because you don't need to see it like that I don't need that much precision, right uh, right Awesome This isn't working Um, so what's our concern right now? And you know what I just realized What I did for my game I made the background red and I made the health green. I'm just gonna do that So it's immediately adding kills health minus equals dpc if health is Oh, I see now so health needs to be less than or equal than zero So that's the minimum can't go negative Otherwise no matter what every time you hit that it's just gonna get a kill. We don't want that So I'm gonna save this and go So we should be at 10 out of 10 health and there we go We have a dollar we have two dollars You could display the reward here if you wanted to it's up to you And all you gotta do is um, we have to make a variable called reward And that will replace this which will be next. So you just want to see if this works So you should be automatically after this kill we should automatically progress to stage two Ah, yes, it works. So now we can go back to stage one or forward to stage two And that's something I've never done before either So awesome Okay, so now what we're gonna do we're gonna make a reward based on Certain stage you're at So I I'm going to show you what I did with my View of controller. So this is what I did. So, oh, yeah, here's my script. Here's all the boss names I had a really like an efficient system Okay, so I use this equation right here So Boss has got a higher amount That's ceiling health divided by 14 Okay, so I guess mine was completely Depended on I remember this it's interesting But I guess we'll make our reward based on Kills so You can have this if you want to so we're not gonna have it Um, we're gonna do a health cap divided by 14 And we're gonna do a math on ceiling. So this automatically raises it to one So we can't get anything less than that right because if the health gap was 60 We got 60 divided by 14 Oh, I'm at the health. Sorry the health is 10. So we have a less than one So we want to raise that to one We don't want to get any decimals here So we're gonna do math dot seal This is a double right We have to do system dot math because we don't have And this is ceiling It's amazing how different everything is, you know And we're gonna get rewarded based on the health cap So another thing we need to be concerned about is what our health cap is actually worth So At the bottom here, we're gonna make a health cap We're gonna make our health cap double each so we're gonna do um system dot math Dot pow We're gonna do 10 And we're gonna do stage um to this so basically we're doing 10 stage So Shoot, this is actually a problem. So let's see. Will this work? Okay, perfect. So we're gonna do this. So we're gonna do one two three Okay, awesome. So we're gonna do 10 times system dot math pow two to the power of the stage number Basically it doubles every stage starting at 10 And I think that's it for that So I don't need to demonstrate I'm gonna do a boss maybe So this will be every five So we need to have some bowls Why is this it? Oh, I see I had an interesting equation right here so We're gonna make it is boss int is boss this is determined if um our current enemy is a boss And we are going to multiply this And this is gonna start as one So once it's a boss, this will be set to 10 But how do we change that so if stage modulus five equals zero Is boss equals 10 else it's simply equals one So how does that work? So how does mod work? So let's say we are a stage one instead of five So one mod five is simply one. All right, so that's not zero two is two three is three four is four It's not gonna show up for me. And then if we are on stage five We get zero So this is really helpful to find powers of certain numbers and um Yeah We could just yeah, I that's the only method. I think we could do this Um, so if stage percent five equals equals zero The boss multiplier is 10 and Or otherwise it's just one So basically the boss will be the boss will be 10 times stronger Than a normal enemy Okay So Our stage text right here Let's make something fancy. Um To add on to this So means we're gonna add like we're gonna have to add these Okay, so when I'm I actually needed to use this text that's dead Okay, so our stage will be regular And then this we're gonna add a Boss Geez, I cannot type. Why is it not letting me type B? Okay. Oh my gosh, this What is this doing boss? So now we can know if this is a boss or not and our money will be More so that's the easiest way to add a boss Is to make the people harder at certain stages Uh, why is this okay? This is not right. Oh, I see stage starting at one. We needed to do stage minus one Or also basically starting at stage two Or we're starting at stage one, but one is it's supposed to be zero, but we don't start at stage zero So now this should be 10. Okay, awesome There damage per second is really slow This is when you add upgrades My goal is to do this in one video, but if people really want me To do upgrades, I will do them But I just want to show the general mechanic that people maybe sometimes don't just like understand how to do While people kind of refer to my other videos and like how to do upgrades And you should be only following this video if you know what you're doing too So let's go our game control. We're gonna make our dpc 15 Yeah, we're gonna destroy these people. Hell yeah, look at that It's so much easier It's I love this. I love being able to go to stages. So here we're getting one dollar here. We're getting two dollars Here we're getting four dollars all right, no, this is This oh, this is 80 divided by 14 We're getting around six Yes, we're getting six Oh, so now we're at the boss. Oh Okay That didn't work Um It's a little awkward All right So this is something that's gonna be really cool about what I tried to do earlier. So let's copy this And delete this So let's go to our health here or our health cap So we're gonna make a getter Because we don't need to set this to anything really because we're setting it in here So we're gonna set this to we're gonna return This math equation What I like about this is that no matter when this is called It will equal whatever this is no matter what you don't it's it's awesome. I love this So now we don't have to worry about the boss Or you know changing it when it needs to be or changing it more than one time So why isn't this working? Let's start 10. Okay, so we're gonna add more dpc because this is boring Sorry We're gonna zoom past this guy This guy's a wimp And the boss. Oh, why is it starting at 80? It's supposed to start at 1600 Uh, you're supposed to defeat this one time. You're right And and I need to have a timer too So we got a few things before we end up this end this video And I would send out so I promised at the beginning I would do a prestige But you can watch my other tutorial. It's pretty easy to implement So I'm just gonna I'm just gonna say that just watch my tutorial series I'll press each video to know how to do that So What's wrong here? So the hell oh, I see why it's because we don't we don't have a setter It's because we what this does it basically makes this um Readable and writeable I'm guessing But once I have to set I can set anything to this variable basically Because yet Like I think this is a read yeah, I think I'm right. I'm not sure how to You know define what get and set is technically gonna differ So let's give us a try. So let's have our health our dpc at 100 cruise. We are awesome This guy suck So wait, what's going on here? Something is flying us right now. I can't determine what this health cap is because it doesn't show up I I personally think okay, so Let's see Oh, what's is boss is boss is 10. So we have our health cap, but our however our health is not Being set to this Can I do dot get? I see this needs to go after That is why we kept seeing that red progress bar It's because it kept setting the health cap to the previous stage even if we move forward. So that fixes that So that it was nothing with the sets. We don't need the sets So I guess this random bug just completely flawed my not my knowledge However With this I don't think we're allowed to set a health cap to anything equals four three Maybe I don't yeah, see It's read only so that's what get is get is read only and set makes it writeable Which you want to make sense if if you had a read Only like if you were setting something inside of it and then you were trying to change it that just doesn't make any sense I think I'm talking a lot gibberish, but Hopefully make sense Oh, yeah, so we don't see that anymore Son of a gun We're so close We're so close So it's setting to 160 instead of 1600 That's a problem Dang, this is a pretty long video so far 47 minutes Well 47 is recording time. I don't know how long it'll actually be So let's let's try this math So our stage is two. Oh, no, it's times two to the square root of It's four times is boss, which is 10 So for some reason it's getting the stage, but it's not getting the is boss is boss is oh, that's right I see why So Okay, we are going to do this We're gonna check we're gonna make a method called public void Is boss checker? We're gonna put this in here. We're gonna run this in updates And every time we die or every time we kill someone we're gonna check if it's in it. It's in a boss or not Um, so let's add the timer real quick So public it's timer, so I'm not gonna add a timer max just because it's we don't Uh, you know what for the sake of it. We're gonna add it because Um, you could add upgrades through it. So we're just gonna make it a default 30 seconds So this timer. Oh, right. So if it's if it's a boss if his boss 10 Then Timer cap. Oh, right so timer Bill equal Timer cap. Is that it? Is that what you need? That sounds about right? Oh, yeah, this is why I added the kills max um Kills max Equals 10 Wow, we only need one kill here. We could make this boss harder You can do that however you want, but I'm just gonna get playable for now Or I will make it playable. That's Um, I'm trying to think right now So we have our timer timer cap kills max I think this will work. Oh, right. So in here Uh, if is boss Oh, we can just do this and is boss checker sweet Timer my time Timer dot delta Time uh, this supposed to be time dot delta time. So this runs on one per second A timer's int. Why did I make it an int? I mean you make that a timer or a Float I can't talk. Sorry Um, okay So If timer is less than equal to zero then we will have The stage go back one. Uh, yeah, we need to reset. So stage minus equals one And Yeah, that should be oh, we need to set health to health cap. Perfect Oh, this is a lot of processing We're gonna add a little progress bar to timer bar and So this all this is the good thing about having a method like this. So we only need to show it certain times While this can be hidden We can just do it by just making up like string or we can just do game objects set active false Whatever you want But I'd rather have two things rather than three Yeah, three set active true set active false and set into text while we can just have two Just kind of makes more sense that way In my opinion, but we also need to have the timer bar dot set active email object dot set active false pickups it's a croak True And we're gonna make timer dot fill amount equals timer slash timer cap I think that should work because these are both loads. Yep. Perfect So I'm just gonna copy and paste this health bg So, yeah, I'm just gonna leave it as this Just because I really don't want to just it's I'm just gonna call it timer Not timber timer And the timer text is here and uh the bar is here. We'll just call this timer bar for the sake of Um knowing where things are So this shouldn't show up ah It didn't um Not a problem. We have the background Um for this I can get rid of the background. Okay, so we will have a background, but I think this works Um, we're gonna make this red. So it's easy to see We are good. So let's get ourselves to the boss Let's make it a hundred like we always do So if we get to the boss, um, why is it failing? Oh, okay. So we have our timer here This health So it's still showing up as one. So we have a few bugs Once we immediately get 10 kills. It won't It won't send us to five. It just fails One more time one more time. We got this. We got this. We got this Yes, this is so awesome. I love this Messing around with this game is not making anything productive is it's still fun Okay, let's get to our second boss. That's much harder now, right? And we should get a bucket load of cash Yeah, there we go. That's a lot All right, so, um Thank you guys so much for watching. This is a really long video If you guys want me to do any more videos on this I can add on and if you guys have any questions Just comment below. I'll try my best. I'm sorry again. I've been so busy with school and life and Trying to catch up on my game and trying to get that rolling as soon as possible And I really appreciate you guys being patient with me and still smashing the likes on my videos So if you guys enjoyed this video, make sure you like the video and comment below what you want to see next And I will try to get to you if you have any feedback on my videos Code-wise anything let me know make you subscribe turn that bell on and one last day I'm gonna ask for Make sure if you guys want to support me, please check this out. It would mean the world to me and I would really appreciate it Uh, again, thank you so much. Have a good day slash night wherever you are peace Hot as Betty's trying to take away my cell phone like coming party. I've been trying to take you off my mind But just can't get you off me. Keep it moving. They ain't worth it yet. That's what my father taught me But for now, I'm going through the motions of letting go because my mind's telling me yes But my heart really don't know your heart when I got to know it yet. I still see a glow So we had the hottest love why'd you leave me in the