So when it kills it, blink, that's awesome. All right, let's see. Ready? Ready? Here's a cool part. Wee! Hey guys, what is up? CryptoGround's here. Welcome back to another YouTube video. This is going to be a part of the Clicker Heroes series. So I am making this a series now where I'm just going to do random videos based on what you guys want me to do. So I had a few requests on my YouTube. One of them is like a coin drop animation. We all have a random bonus to click and collect as they pass by. We also have an offline rewards. And that's it. So yeah, we'll do that. I'll try to do as much as I can. This video is doing pretty good so far. Before I get started, I want to bring up my Kofi account. If you haven't checked it out, make sure you do. If you want to support me, buy me a coffee, I would highly appreciate it. And if you have Pinterest, you should follow me. I am Cryptograms. I'll be posting all my stuff on here. And I kind of just want to spread awareness of my name. Hopefully get my tutorials spread out and my own idle games. So I'll be posting a bunch of screenshots here. So if you guys are curious, here is where you'll find the good stuff. Or you can just join Discord, which is found on my Pinterest. Right here. That's how you join my Discord server. Let's get on with the actual video itself. So I got to pull up Unity real quick. So to get started, let's look up a coin. I think I'm not going to know how to do 3D stuff. There are 3D effects that some things do. So I'm just going to have a little icon, just for basics I guess. I'm just waiting to have a coin icon. If you don't want to make your own, I'd really suggest you search for a copyright free picture. It would be kind of difficult, but let's see. You know what? This is not transparent. You know what? I don't want to do this. So we have one right here. So let's save it. I'm just going to save it to my downloads. I know. I'm not very organized. Okay, it imported. So let's add this. Let's add a group. So we're going to make it empty. Coins effect. So I guess I'm showing you general animation. I said I wouldn't do it, but I guess I am now. It says how it works. That's all good. I feel like this is something for me to kind of, you know, get better at, since I don't do enough animation. And animation itself is actually really confusing. So maybe it's a good thing I talk about it. Alright, so we're going to have our, we're going to have three coins pop out whenever a mob dies or enemy dies. So we're going to put our coin here. Let's make it 50 by 50. So we can just have it start at any position you want. So we're going to have C1 for coin one. And we'll just duplicate that three times. So what we're going to do here is create an animator. And then in the animation tab right here, we're going to create an animation. Make sure you're selecting on this empty object right here. So we can animate all these objects within this one animator. I feel like that's something that some people get confused about. Like, oh, maybe I should just do an animator each one. But this is so much easier because you don't want to, you know, have three different animations playing at once. While you can just play one, it'll do all three, move all three objects. If that makes sense. Oh yeah, so here's some animations I made in the past. So we're going to call this one coin explode. So to do this, we are going to just basically record, just going to record an object moving just to have a template. We're going to do the same thing here.  We'll do that. So I have them look quite slight again. I have to be quiet. So, you know, I know it's not what you're expecting. Trust me. So yeah, here we go. What we can do here for each one of these is add a, add a property for each one of these is active. We'll make sure it's false at the beginning. And then right after it's going to play the animation. So we don't see it all the time.  There you go. That's what we've seen. But until we hit the next frame, we got to turn on everything. Boom. I could do it. I mean, yeah, this makes, this honestly works. This is a really basic animation. Boop. Okay, so we can continue doing stuff with this. And we want to copy this at the end so that we know it turns off at the end. So when it's done playing, it'll be hidden. One more thing I completely forget. For each one of these, make sure Raycast target is on or else you can't click through them or else you're clicking a bunch of coins. And I think when this is off, it doesn't matter. But I think just in case. And I'm going to keep animating this. You can just follow along. What's cool about animating is that it creates curves. So it's not just like boop, boop, boop. It just makes a big line. All right. And then right here, these are all going to fall. Nope. Nope. And boop. All right. So it looks like this. It's a little wonky. Yeah, especially there. This one right here. That is very, it's a little slow too. So let's fix that. Let's try to fix that. It's a little better, but it's still going way too far out. So these kind of fade out too fast. Well, these come in too quick. So we can scoot these. I'm going to scoot this to like, oh, that's really fast. Never mind. This is going to be a 25, 20. So something like that is fine. I think that looks good. Okay. So there's a few settings that we have to do. So if you go to animations or wherever you saved it, make sure you go to coin explode and disable loop time. Or else if you play, it's going to continuously play. We don't want that. Cool. We're good to go. So in our code, I think this one, yes is. Okay. So what we're going to do here, we're going to create an animator. So we're going to do public animator. I think, actually, I think it's animation. Not completely sure. It's animation. We're going to do coin explode. And we're going to go back to here. And also with this right here, we don't have to do anything here. This is all set up. Yeah, it is animator. That's what I thought. All right. So in the code, every time it's killed, we're going to run this one command. Kills plus one. So we're going to coin explode play. And we're going to put the title. It's coin explode. Ah, why is it doing this? Coin explode. Coin explode. We're going to do zero, zero. So the layer is, I'm not really sure what this is. I'm guessing it's something to do with like this right here, but I've never used it before. So I just set it to zero because that's the default layer in anyways. And this one, normalize time. I'm guessing that's just speed or the start. But I, again, I'd put it at zero because that really doesn't matter. And this will play once. So let's give this a try. This, I haven't done this in quite a while. So if I get this right first try, that'd be awesome. And I didn't look at any code before this. So. Ah, yes. Look at that. Boom. Awesome. That works. But the problem is that it's playing at start. I don't know why. That's right. Right here. So this is where this comes from. So here is really cool. You can make transitions and it's awesome. I love it. But it's really tedious sometimes. So on entry, on play, it will automatically trigger this animation. So what we're going to do is that we're going to right click. We're going to create an estate or it's going to be an empty state. And then we're going to right click on it. And we're going to set to the set as layer default states. And basically on entry, it's going to do absolutely nothing. If we start. Ah, the coin doesn't turn off. That's another thing. We need to add a game object. Coin explode. Actually to avoid doing anything code wise, we can just simply turn this off. So it's hidden. And then. Oh, right. We have to. So coin explode game objects. So do you know what this action might work? So we have to turn all three of these off. Because that's what the animator does. It turns it on and off. See, this is automatically being played on entry. So let's see you ready. Boom. See, they turn on and off. Look over here. Just turns on and off. Perfect. So we got that working. This animation not be perfect since the coin goes whoosh. But you know, it's good for now. You can do it however you want. Just be creative and have fun with it. All right, next up. We are going to do we're going to do offline production while we're at it. Okay, so this is going to be a little different one. So up here, we're going to need offline. We're going to need some stuff. Oh, let's push up here. We're going to need using system. Okay. So we're going to need a public date time. Current date. Public date time. Old time. This is not safe for time hacking. It can bug, which is a half at your fault for cheating. But it's not guaranteed to work all the time. It can't stop it. So if this is the only way I know how to do it. So you'd have to find a different way if you want something safe. But otherwise, let's just get on with it. We're going to need a... This is where we need to make the save system. Offline check. What else do we need? We need a float. Public float. I'll time. This is to measure in seconds. So since we don't have anything that factors production, we're going to make an artificial one that does damage one per second. We're going to just have DPS. And we're going to set DPS to once and no matter what, it's going to do one damage per second, right? This is a little difficult because I've skipped so much steps. I've been avoiding upgrades as much as possible just because it's kind of a, you know, you can do it on your own thing. So we're going to make a method called load offline production. Public void load offline production. I always do this. So we're going to do ifdata.offline... How am I doing data? It's offline project check equals one. If it's true. We can't actually make this... Let's do that. If it's true, we can just leave it as is because it's a state. And then we're going to do long. We're going to create temporary value for offline time. So this we need to stop here. We need to create our save and load system. I don't like doing player prefs honestly, but I really do not want to show you the complicated way. Definitely not. That is supposed to be for the original series. I'm not going to do it in this video. Because it's more like a copy. Actually, I do have the save system. I just don't want to copy and paste it. So we're just going to do this in here. I feel like that's bad to do. But honestly, getting the data... From my old game, this is actually player prefs anyways. So we're okay. I can't remember how to do player prefs. So ignore all this redness. Okay, so what we're going to do here is... This is a save. So we're going to do playerprefs.setString. Yeah, we need to set a string.  We're going to call this money. And we're going to put money.toString. So this is what we need. Ignore the red.  So we're going to copy and paste this. DPS health. We don't need health cap. We don't need timer. Health should automatically be up. We don't need this either. Stage. Yeah, this is all the stuff we really need. And luckily, this is a lot simpler. It's just set int stage. And we're going to do stage. Stage max kills... Kills max is boss timer cap. I don't think we need timer cap. However, we might need everything else. I just want to be safe and add it. Kills max probably not, but I'd rather be safe. Okay, we can delete all this garbage right now. So this is our save right here. Oh, actually, we have one more really important thing. So that's this right here. We don't need to save float time. So we're going to do... We're going to make another string here. Up top. I'm just going to paste it here. Yes, I know. I copied the P. I was hoping for this video to go a little faster, but it's okay. We're going to do offline progress check. Two strings. We're basically converting a bool to a string. Right? Is that what I'm doing? You know what? That should be okay. Let's do set int. I like set int. It's nicer. So that means we can't do this anymore. We've got to do if progress check is equal to one. Okay. So now for our load system, we just got to copy and paste all of this. Replace all the sets to get. And so now we've got to do money equals... Ah, shoot. We forgot to do DPC, DPS. I hate player press, but the passion. I like my method. It's really complicated. That's something I can't just really teach you how to do it because it took me too long to invent for me and someone else to invent. So these are going to be our default variables now. So we're going to do 0, 1, 1, 1, 1, 0, 10, 1. This should be 0. So now we don't need this... Oh, right. These are going to set these as strings. And this is actually going to be double, double dot pairs. That converts a string back to a double. It's amazing how math works. Okay, I think we are... Oh, shoot. I know. I'm looking at a code. Not good. Not good. Not good, Zach. Not good. I just don't remember what offline time was. Okay, we need to open up my save system. Sorry for the hold. This is quite awkward. Also, if you want to see my save system without revealing... This is what it looks like. Not a bit nice. Offline time. I see what this is now. So for save, we're going to have this line right here. So this basically calculates... We only need this right here. It basically keeps track of the current time when saving. And we're going to be saving every five seconds. So down here, we are going to load that by converting... Since this is a string... Along is basically a 64-bit integer, I think. Yeah, in 64. We're going to do convert to into 64 player fresh dot get string. We're going to load offline time. That's it. So we have our time right here. Previous time. I'll just call this previous time. You don't ever really need to mess with this ever again. And we're going to have another date time. Or old time. Don't we have an old time now? That's what I thought. Okay, so we don't need to make this. I don't know why. So date time dot from binary. Again, I really don't know how this all works. I looked for some tutorial from millenniums ago. So I honestly don't exactly know what some of this stuff, but I know it's something to do with converting seconds to certain numbers, I guess. Okay, so now our current date. System dot date time now. And we don't need the system. All right. So that's easy enough to follow. And we need to calculate the difference between the old time and the new time. So we're going to do a time span difference equals current date minus old time. So that should work. Actually, I think you have to subtract these. This has a certain method from date time. Yeah, that doesn't work because it's not just like a number that you can just subtract. It's like a... See, can I pull it up? Nope, I can't pull up the struct. Anyways, let's continue. So we're going to go to our idle time equals float difference total seconds. Now I can't remember why we cast it. It's total seconds is a double. This can be a double if you want to, but I don't really don't think you're going to get past 3.38 seconds. That's totally, you know, totally possible. So it only needs to be a float. All right. So this is where we add our damage basically. And I'm going to do this by gold. So our money plus equals health cap. So what's the reward? First of all, this is the reward right here. So now they have system. We can just get rid of this system dot math. They can just use system or math dot ceiling. Anyways, so we have a reward right here. We're going to times it by idle time. So basically, if we were gone for one second, we would be getting this much gold. But we need to multiply by DPS. So basically for doing one damage per second, we're still missing something, right? We need to have our health. So let's say this is 100 gold is the reward of the monster. And the guy has 80 health. We are doing one per second. So let's say the reward is 100. The boss has 80 health. And we are doing two per second. So in this case, we are getting 2.5 gold per second. But we don't want to make it that big. So in offline production, it's usually divided by good amounts. In crypto clickers, I actually do it very small just because it's not very offline friendly. So I do it very small. It depends on how much you want to do. But for this one, so we can actually see what's going on, I'm going to do divide by five. So every five seconds, you're getting the same production in the real game. If that makes sense. So that's it. Oh, the timer, right? We want to add a, how long were you gone for? So we're going to add a text, public text, offline time. Text. Sorry about that. So the text is going to equal you were gone for. And then we're going to add something cool. But I just found out the other day, actually, we can use time span. We're going to make a timer goals. I remember how you did this. Yeah, I was doing right. From seconds idle time. And basically this formats it for you. This is awesome. Plug that in. We're done. Oh, actually, no, we're not done. We're missing one thing. Shucks. This is what I don't know how to tell my, I hate looking back at my code because I feel like that's not learning, but it must be done sometimes. Finding is the next problem. Okay. Sorry. This is what we need. Timer.toString. We need a format this way. I can't remember that, obviously. So this formats it as hours, minutes, seconds, and hours just keeps growing, I believe. Okay. So we are good here. All right. Oh, yeah, I want to add another thing to the text. We're going to add a new line, which you do by backslash n. You earned our money to earn. So we don't copy faces twice. Also, it looks like this is redundant right here. So we're going to add money by money to earn and put that there. We don't need that space here. Okay. We should be good here. We got to make the pop-up right. So we have so much to do. Public float save time. Save time plus equals time dot date delta time. Right now I'm basically making the five second timer. If save time greater than equal five zero. And save run. What I could do is put this at the bottom. I could do return. No, that's pointless. Never mind. Scratch what I said. So and on load, we can get rid of these two, these two, this. How do I have no health? I swear I had a health. Okay. So health equal health cap. Since we're having a safe system, we're going to have this is boss checker. Get rid of that. And we should be good. Oh, we need to have our load. Is there anything I'm forgetting? I don't think so except for the box public. So we could play this in load. So this will only show up if it's off, which we will turn this off automatically. So we'll do that by game object dot set active false. We're going to copy and paste that. Run that in here. If it's true, then we will show this offline box. All right. So we should be good. Okay, so we're going to make our offline thing. I'm going to try to speed up the pace because I feel like I'm flying behind on time. I was hoping for this to be like at least a 15 minute video, but I don't think that's the case anymore. Let's see where we're at. 41 minutes. That's not good. Offline. Okay. So we're going to make this a little box. Sprite. I'm going to use this one. It's really not a good color theme. I understand. But this will work. We're going to make this a big box. So we just need to have this one text. So we're going to copy and paste so we know what it says. What did it say? You were gone for zero, zero, zero. You $100. We could have another new line here just because it makes it look a little bit. But let's just stretch that out like this. Perfect. So our game controller, we need to have our explode object. So that's this coins effect offline text offline box. Oh, right. We need to have another method. Public void close offline box. And if this is clicked, basically the offline box dot set active. I wish it was just set active. That would be awesome. Game object. We're going to set that to false UI button. This is just going to be your simple okay button. We're going to drag our game object. And close, close, close, close, close. All right. We should be good. So for the first time offline will not show up. So let's get some kills. So let's save. Let's make sure it's actually going to. Yep. So let's save. We're going to close. We're going to wait a few seconds. Okay. So let's give this a shot across my fingers that it works. Okay. So we have positive news. The save and load worked. However, the offline progress did not. And I think that's just because we forgot to think we forgot to load. I think that's where we went wrong. So let's just close out of that two, three, four, five, too long. Let's go. The idle time. So this is still zero. Okay. So this is where we can set this to one because it's basically it's doing nothing. So let's just click in this loop where it won't ever check it because it needs to change to one somehow. So on first save, it will change to one or it will just keep saving the one obviously. So after this, it should work. Okay. So after this one, it should work after the save. Yep. Here it is. It's one. You're good. So let's wait like one, two, three, four. This should be like around 10 seconds. Eight, nine, 10. Other than it's loading as a zero. So let's see. I'm going to check to see how I did that. So I seem to get into houses every time I do something. So I see what I did wrong. So this is going to be a little funky how I did this. I don't remember exactly why I did it this way, but I had this something like this right here. So this is going to be like a temporary variable. It really doesn't mean anything. So this only loads once. What's wrong? There's nothing wrong with this code. No way. Okay.  But I don't really, I still don't get why this progress check is still being weird. It's probably in the same system. Check. Sorry. I know you guys can't see it. So when it's save it, it automatically sets it to true. Okay. So maybe this is what we need to do. I see why. It's because we have to save it one more time. So this right here, I don't think this is affecting anything at all because it's loading your progress just fine, right? I think it's this. It needs to be before the save. So that should make sense.  Oh, okay. Okay. So we have 10 health. So let's do some math real quick to make sure. So we have 10 and our DPS is one. So it's 10. Oh, right. I forgot we did this way. Okay. So health cap is 10. So 10 divided by 14 ceiling. That's one. So our health cap is 10. So we get 0.1 per second times DPS, which is one divided by five. So we should be getting approximately 0.02 on our offline. And I didn't see that. So we'll see. It's a really large number, but we can fix that real quick. We'll do .2 string F2. Two digits is the magical number. It's getting late. Hopefully I can get to the other thing I had to do. 24 seconds. Awesome. So we're going to do that. Times 24. It's around that. Obviously I know how to do math, but it's somewhere around 0.201. Oh, the time. That's what that is. Okay. So this is right. It's the time. It's .6. That is why we get 49 cents. And it adds to our offline progress. Another thing is that if you want to do kills, you can. You'll just have to do like a total damage while we're gone. And just have to kind of make an equation. And I personally feel like progression that way offline doesn't work. You should just get money. So I'm not going to show it, unless it's a really high demand thing. But therefore we got our offline production working. So let's try going to a higher level. Stage 2. Let's have it save. We're going to wait a few seconds. While we're waiting, hopefully I'll remember. Let's get started on that random multiplier thing. So I'm not going to have any animation or anything to this, since I showed you how to make one. But I'm going to add this special like eyes thing right here. Just because it looks spooky. So this will be our little multiplier thing. That will show up a random time. So this will basically how did this person want me to do it. Bonuses to click and collect. So the bonuses I'm going to do is money per second. I'm just simply going to do that. This one, for example, will be 2.26. It's going to be completely random. How much money you get per second instantly? Actually, it needs to be big. That's lame. So 20.26. Okay. I'm going to put this doesn't look very aligned, doesn't it? There you go. That looks a little better. Anchor it to the corner, maybe the side this time. So this is going to be our little multiplier text. We're going to be able to click this in the region. So that means we're going to need a button. Okay. So in here, we're going to do our mult. So our public. So we're going to have a text. We're going to have our multi-text. Public. We're going to do double. Public, double, mult, value. And I feel like I should have a money per second value. Even though you won't be able to see it. So let's set that something real quick. So that's, that's really easy. You just need to copy and paste it from down here. This is basically your, your, your money maker right here. All right. So our mult value will be set every time we click the button. So on start, we will make a random math equation or not a random number from whatever range you want to. So how are we going to do that? We are going to do. Sorry. So we're going to set it to a, I hate this system dot random dot next. I don't think I can do that. Okay. I don't like doing this, but it's random dot. Call it anything. I'm going to call it ran new random. We're going to have a new system dot random. This static of this work screw you unity. No one likes you. We call it something. All right.  So we have to do system dot random because the unity doesn't know how to make their own goddamn names. So we got to do this now. So ran dot next. We're going to create a random number from I say we should do 20 to 100. That's an end. Right. Okay. So I guess it'll just be a random, a random thing right here. So this is our multiple value 20 to 100. We can do that. Awesome. So our multi value is going to start as this. Oh, you know what we can do here. I know math is awesome or C sharp is awesome telling you. Okay. So we got our, we don't need this anymore.  We don't need that. So our multi value is going to be that times. Oh, we need to have to actually. Okay. So that works. So this will change every time we find this. So now we also need to have another random timer. So we're going to have a timer value. Oh, we need to make these floats. This is going to be a long video once again. So our timer is going to range between what is wrong with this code. Ah, I see now we're going to arrange it for testing purposes. I'm going to do it in between five to 10 seconds. Okay. For most players, I would suggest between 100 at 300 seconds. That's like a minute 20 seconds to six minutes. It's just something random. Maybe if you really depends on how generous you are or how big your multi value is. It can't be super like game breaking, of course, because that's really unfair, you know. So that's for you to balance. So the timer will automatically be set to zero. So we need to set that to, and then at the start, we're going to have our multi. I should be doing this at the bottom, but I'm kind of just, you know, not wanting to scroll down. So we're going to subtract this by a time dot at the time as a timer. If our remote is less than zero or equals zero, then we will create a brand new cap. We will set the time remote to that cap. Again, this is getting a little repetitive. We could put this in one method if we wanted to, but I'm not going to. And our object, this is the object, public image, game object, molt. I'm just going to call this the molt box because I'm not very good at names for tutorials. So I just kind of just go with it by start. We're going to disable this. And here we are going to turn it on. Oh, we also have this text we have to set. This one's just going to be molt value. You know what? Actually, we're going to display how much money you get instead. This is just going to be a two string. Two, this might be a big number. So if you watch my video and do X-Men system, you're good to go. What else do I have to do? Oh, yeah, right. We have to do our click public void open molt. This is what I'm going to call it. So once it's clicked, I'm just going to copy and paste this. Molt box will be turned back off. Our money will equal. So the timer will actually not be reset here. So this will all be gone. We can move this up here. Boom. Okay. So this will happen. And here we can move this up here too. Because we only want this timer to go down during that. So if it's less than, this will happen. Otherwise, it'll keep counting down. So the timer cap will reset. Our money multiplier will reset as well. Money plus equals molt value money. I think that's it. I honestly think that's it. That's awesome. Okay, let's do it. Let's give it a shot. Open molt. So this will be instead. Yeah, that's what it's going to be. And we could probably see this change too as it goes up. So we'll see how that looks. Molt box, Molt text. Let's give this a shot. Okay, so good sign. Oh, okay. So we have our minutes here. So we got some hard earned money. Oh, wow. That was only nine seconds. Oh, you're right. Yeah, that was only nine seconds. And it's still counting down. I don't know why. So we should get nine. Awesome. So this is 63. Okay, so there's something a little mixed up here. Okay, so this is our molt value. And right now, obviously we're getting 0.1 per second. That's why we're getting this. So we're going to click that. Boom. Here we go. Here's our random multiplier. Obviously, this is really weak. So let's see. We'll just change as I level up. So let's change my... And I totally forgot to add the damage per second. So let's just do this. And this is what it looks like if you click class. Oh, yeah, you see, that increased. Oh. It's because my DPS is one. It's really low. Nothing's changing about this. Okay, so let's try to experiment. What is money per second? Oh, I don't see it. All right. This is getting tedious. It is going... This is getting a little annoying. See, I don't know. That was weird. That was definitely weird indeed. But it does work. It works. It was just the money per second was odd, I'm guessing, because of how long it would take. It's just definitely not worth the reward. But yeah, I think that works. Oh, one more thing we can do real quick. And update. We're simply just going to do health minus equals... minus equals DPS. And then... So we're going to copy this right here. So if health is less than or equal then, we're going to run a new method we're going to create called kill. So for hit, do public void kill. And basically kill will be all this right here. This stays here. This comes with me. Kill. There you go. Awesome. That's it. So now we should have a DPS now. We should be earning not too much money from offline. Let's see about that. Yeah, I figured. Oh, one more thing. One more thing before we end this video. This needs to be a times dot time delta time. And then we're good to go. We're also running 60 per second or whatever the frame rate is instead of one. So let's go all the way back to stage one. So that's the nice thing about these buttons.  That's for sure. I still like to show two decimals. You could show one or zero for this one honestly. But I'm going to do two. So we have to offline. We have the random multiplier. Six. Five. Four. Awesome. So we have that working. We have the little animation thing. What's going on here? Why are the coins not playing? That's a shame. Oh, it's because it's playing. That's why this has to play no matter what. Okay, that was our last change of the video. Okay, so now it should work. So when it kills it. Blink. That's awesome. I love this.  All right, let's see. Ready? Ready. Here's a cool part. Wee. Normally these would do the same. That's kind of weird. Must be the reward, I guess. The reward curve. And this should be a little higher, but that's okay. I'm not doing any damage. Yeah, otherwise it works honestly. It works just fine. That's what upgrades are for. This won't be this low at stage 16, obviously. Anyways, I hope you guys enjoyed that video. That was way, way longer than I expected it to be. That was another almost like 15 minute video. Totally not intentional. And I hope that's okay. Anyways, make sure you check out my Pinterest. Join my Discord server. Hit that bell button. And turn on notifications. Subscribe. Like and comment on the video as usual. And donate me if you want to support. Anyways, thanks for watching. Hope you guys enjoyed this. Thank you.