Introduction to Heads Up Display (HUD)
A free video tutorial from Stephen Ulibarri
Engineer, Programmer, Game Developer, Author
4.6 instructor rating • 4 courses • 296,806 students
Learn more from the full courseUnreal Engine C++ The Ultimate Game Developer Course
Learn how to develop, code and package a complete video game in Unreal Engine
34:27:15 of on-demand video • Updated May 2021
- How to program in Unreal Engine with C++.
- How to create a complete UE4 game from start to finish.
- Those with no experience in Unreal Engine will master Unreal.
- Combat, adventure game mechanics, platforms, game saving/loading and menu design.
- Those already experienced in game development will further expand their skills.
- Those who already develop in another engine such as Unity will master Unreal.
English [Auto] OK, so we very roughly sketched out a kind of a state machine for the stamina bar, basically we've decided that we're going to be in one of four states at any given point in time. And while we're in that state, we're going to check to see if the shift key is up or down and for that particular state will have different functionality. And that functionality is either going to be whether or not we're regaining or draining the stamina bar, whether or not we can. And it's going to also determine the color of the stamina bar to indicate for the player whether or not they're getting dangerously low to close to zero on the stamina bar. They'll be yellow. Or if they've reached zero, then they'd be orange. And that's the exhausted state. And they'll be exhausted when it's drained and exhausted, recovering when it's recovering back. And in that point, we will not be able to sprint until we've reached the minimum stamina, a point at which point we can get back into the normal state and we can restart the logic from there. It's going to go ahead and close out this rough sketch. And in the main character, I would like to add a new Innu. I mean, this anum is going to be for the sprinting status. And so I'm going to say anum class and I'm going to call this E stamina's status, actually. And that's exactly what it sounds. It's going to be for the status of the stamina. So let's go. You and you and aides, and let's make this right off the bat, a, you know, and I'd like to make this blueprint type as well. So let's say you anum blueprint type. And so for this Enuma, we're going to make a e stamina's status normal. So it's normal and I'm going to use the you met a key word and display name and set is equal to normal. So we said that we had a normal state. We also said we'd have a below minimum state, so I'm going to call this one. It's below minimum. And I'm going to give this display name below minimum. We also said we're going to have an exhausted state, so I'm going to make a E exhausted and I'm going to call this one exhausted. And finally, we said we'd have an exhausted recovering, so I'm going to make an S as exhausted recovering state. And call it exhausted, recovering. And similar to the movement status, and we're going to also have a max and this will be default, it's not meant to be used, but it's meant to cap this off and have a definite default Max. I'm going to call it default, Max. And it's going to be it's as Max, OK, so we've got an anum to describe our stamina status, and so I'm going to create an enzyme called stamina's status in the main class. I'm going to say e stamina status and I'm going to call it stamina status. And I'm going to also make this one visible anywhere and blueprint read. Right. And I'm also going to place it in the category Anum, so I can simply copy the new property from our last Enu. Now I'm going to have a set stamina's status and this is simply only going to set the standard status so I can make this a force in line and it's going to be a void and it's going to be called set stamina status. So it'll do exactly what it sounds like and it's going to take an E stamina status called status, and it's going to simply set stamina's status equal to status. So we have a set of function here and that looks good now in the constructor. Let's give this a default value and it looks like I may not have initialized the other one. So let's initialize both of these. Let's say initialize Enuma. And the first one was going to be movement status. Actually, it's called movement status simply. So movement status equals e movement status. And let's give it a normal default and stamina's status equals e stamina's status. And this one will be also normal by default. Now, notice, Ms Normal is different than E. S as normal. And so don't get these two confused. And that's also a good reason for doing scoped. Ingham's where you have to fully qualify and specify the scope of this enum constant just in case you have constants that are the same between inUS. So always fully qualify your enum status if they are scoped Ingrams, some items are not and you can just simply use the constant itself. But for our cases, this is a good habit to be in. OK, so we've got this stamina's status. We've got a default value in the constructor. Now we're ready to script out the functionality for this stamina. A bar. And I mentioned we're going to be draining things. We're going to have a stamina draining rate. And so what we're going to need is a variable for the stamina drain. Right? That's one. And we're also going to need a variable for the minimum sprinting stamina. So let's give these right here in the same section. We're going to say float min or let's say stamina, drain rate. And we're also going to have a float, men sprinting or men's sprint stamina doesn't matter what we call it, as long as we're consistent. So this one is going to be a new property. And what I'd like to do is let's make it let's copy this new property here and let's actually make this edit anywhere so we can tweak this easily. And instead of Enuma, I'm going to give it a movement category. So let's put it in the movement category and we're going to use the same one for both of these. And I'm going to go ahead and initialize these right off the bat with the stamina drain rate equal to. And it's not too important. We'll we'll tweak this as we go. I'm noticing our our max stamina is 350 and our stamina will start off at 120 so we can give it something like 25 f if we're thinking in terms of units per second. And so if we're sprinting and holding the shift key down, we can do like twenty five stamina per second, smoothly draining. So I think that'll that'll work and force men sprint stamina. Let's give this a value. If Max is 350, let's say this should be something close to zero or like oh let's say, let's say 50. Yeah, 50 f. And just so when we're testing it doesn't take forever to get down to this. I'd like to make Max stamina something like closer to one fifty. That effort and stamina will begin at 120, so it'll be it'll start off close to the max and then if we get down to men sprint stamina, which is 50, then we should trigger the yellow color and stamina. Drain rate will be 25 units per second. So it'll take a few seconds to get down to that. OK, so we've got some variables. We got some default values. Now let's take care of draining the stamina and draining the stamina is perfect for the tic function. A tick function has Delta time, which, when multiplied by some sort of rate, will give you the exact amount that you need for that rate in units of units per second. And so what I'm going to do in the tick function is create this float delta stamina. Delta stamina is going to be how much the stamina should change in this particular frame in order to drain or recover. And so we're going to have a stamina drain rate. So stamina drain rate, we create that and we multiply it by delta time. And so that's the Delta stamina for this frame. And we'll use that both for training and for recovering. Now, if you wanted to, you can have a stamina drain rate and a different float for stamina recovery. So but the process is basically the same. Calculate how much will change this frame by multiplying by Delta time. Now we have a stamina status, right? If we go back up, we'll see that stamina status here has normal below the minimum, exhausted and exhausted recovering states. Now, rather than do a bunch of false statements, when you have a bunch of states here and you're in one of any of these at any given time, this is a prime candidate for using a switch statement. And so you can simply use switch. And for the switch that you're switching on is going to be our stamina status. And basically what this will do is do something depending on what our state is, and we're going to have different cases, depending on what stamina's status is equal to. So case one would be basically stamina, status, colon, colon, normal. And we're going to do something here. At the end of it. We're going to break because we if you don't have a break here, then basically you're switch will go through to the next state. But if we're in the normal state, we want to do something and then break out of the switch and then we need to specify the next case. So easy stamina, status. And the next one is going to be let's next do the below minimum state and we'll add a break and then we'll do the next state. And after below minimum, we're going to do the exhausted state. So it's stamina, state status, rather exhausted. We'll do something there and then break, and then finally, the exhausted recovering, so e stamina, status and exhausted recovering, we don't need to do anything for the max because we don't intend to actually be in the max state ever. OK, so and it's it's customary to just do a default. And if you don't have really anything to do for the default, you can just do an empty statement. So just like a semicolon like that. And so now we're ready to script out what happens in these various states. So we had our rough sketch and in the rough sketch, we basically said that we're in the normal state. We need to check to see if the shift key is down or not. So in the case, yes, as normal, we're going to say if we shift to key down now, if we shift key down, we're going to do something. And if the B shift is not down, we're going to have an else statement to do something else. Now, what we're going to do in the B shift key down is we're first going to check to see if are we're in the normal state. Right. And we're draining stamina when the shift key is down. But before we drain any stamina, before we decrement a small amount from the stamina, we need to see if such a small change would put us into the below minimum state if we're going to cross that minimum stamina variable. So we're going to check first if and we're going to say stamina minus Delta stamina is less than or equal to men sprint stamina. If that's the case, then we're going to be crossing from the normal state over into the below minimum state. So we need to set stamina, status, e stamina, status, and we're going to set it to the below minimum state. Now, that's OK. We can still drain the stamina. So stamina is minus equal to Delta stamina. So that's good. But it's important that we update stamina status to the below minimum state. So that way in this frame, if this amount that we would drain it by would put us into this below minimum state, go ahead and do that, but still also drain the stamina. So that is good. Now, if this were not the case, basically, if stamina minus Delta stamina is not less than or equal to men sprint stamina, then that means we're still good to be in the normal state. So in that case, we don't need to set movement status. We just need to say stamina minus equals Delta stamina. And we're good. So in that case, in that case, we are good to just decrements stamina a little bit and we're good now if in the tick function, basically if the shift key is down, then we need to make sure that our movement status is correct. And so we we need to update the movement status as well. Now, we could do this in the SFK down function, but the shift key down function is very specific. It's it's called shift key down. And I'd only like to keep that be shift key down, boolean changing functionality in there. And I'd like to keep the stamina, the movement status here and tick for this particular application. So Intec, if we're in the normal state, if the shift key is down, then we can set the movement status. And we can say e movement status, sprinting, and so Intec, if the shift keys down and where in the normal state we can have our sprinting. Now, the reason I want this Intec again, not just I mean, there's the reason for having the sprint keyed this shift key down function, do exactly what it says, but it's beyond that. You know, if we're in the normal state, sprinting is the state we should be in, which is what our animation is tied to. But remember, there's going to be states here where we're holding the shift key down, but we shouldn't be sprinting. We shouldn't be able to sprint, for example, if we're exhausted. And so that's why we're going to stick it in this switch statement based on our stamina status, because that affects whether or not we should set our movement status. OK, so we're in the normal state, if the shift is down, we've got this functionality. However, if we're in the normal state in the shift, key is not down, then we're in this else state statement here. And if the shift key is not down, basically we can just we can say shift key up. If the shift key is up in the normal state, then we need to check to see if our our stamina should be replenishing and if our stamina is replenishing, we need to see if we would go past the maximum because we don't want to keep increasing the stamina. Packs pass the maximum. So let's check if stamina plus deltour stamina is greater than or equal to max stamina. In that case, we don't really need to increment the stamina. Well, we can stamina. It is going to be incremented up to the max basically, so we don't want to increment it more than that. So we just set it equal to the max. Now, if that's not the case, if incrementing the stamina would not push us over the max, then we can simply increment it by Delta stamina. So stamina plus equals Delta stamina. Now, if we're in the normal state and the shift key is up, that means we should not be sprinting, so therefore we can also have a set to the movement status or set movement status. The shift key is up. So it's going to be said to e movement status, normal, MS normal. So that should take care of the normal state. We have two cases where the shift keys down and the shift keys up and then in the shift key down, we check to see if stamina would if draining the stamina would put us into the below minimum. If so, change the state to below minimum, still decrement the stamina. Otherwise, we're still in the normal state. So just decrement the stamina and the shift key is down. So we're going to be in the sprinting movement status. Now, when the shift gears up in the normal state, we're going to check to see if incrementing stamina would put us past the maximum. If so, just set it equal to the maximum, if not incremented, because we won't be going past the maximum. And either way, the shift is up. So we want our movement status to be normal. So that's so far so good. Now, in the next case is the next case is where we are below the minimum sprinting stamina. So what we need to do in below minimum is similar to in normal. We need to check to see if the shift key is down or the shift key is up. So first we're going to say if we shift key down, we're going to give this a body and then we're going to have an LS for when the shift gears up. So I'm going to just comment here. Shift key up just like I did above. And so let's think about what we need to do when the shift key is down, when we're below the minimum. So first of all, we're still going to be draining the stamina when shift key is down and we're below minimum. But we need to check to see if the stamina minus Delta stamina would put us down to zero. So if stamina minus Delta stamina. Delta stamina is less than or equal to zero F in that case, we need to change states again. We need to set the standard status to exhausted. So we're going to say set stamina, status, e stamina, status, and we're going to choose exhausted and we're also going to set the stamina equal to zero. And finally, we also need to set the movement status to normal. So set movement status to e movement status normal. And that's because, you know, if you're exhausted, of course, you need to put the stamina or the movement status into the normal state. Now, if if stamina minus Delta stamina puts us into the exhausted mode, we do that. Otherwise, if stamina minus Delta stamina is not less than or equal to zero, then we're still in the below minimum state. So we simply just need to decrements, stamina, stamina minus equals delta stamina. And if we're still in the below minimum state and we're not exhausted yet and the shift key is down, then our movement status can be in the sprinting state still. So we could still be sprinting. And so we're going to set it to eat movement status, sprinting. So that's the interesting thing about below minimum is we're going to be below minimum, so we need a new state for that because we want the bar to be yellow. But we need to check, first of all, if we're going below into the exhausted state. But if not, we need to simply drain the stamina and make sure we're still sprinting. OK, so we've got the shift key down in the below minimum state. Now, what about shift key up, so shift keys up. We're going to be recharging the stamina and we just like we did in the normal state, we need to check to see if this should be transitioning into the normal state. So if. Stamina plus delta stamina is greater than or equal to men sprint stamina. So if it's greater than men sprint stamina or if it's if it would push it up past that limit, then we need to set the stamina status back to normal again. So set stamina, status, e stamina, status, and this will be normal. And yet we are still recovering stamina so we can still do stamina plus equals Delta stamina. So that's if we should transition to the normal state now, otherwise we can simply increment stamina. Stamina plus equals Delta stamina. And that's that particular case now, if the shift key is up, regardless of whether we're transitioning from this state to the normal state or not, we still need to make sure the state is not sprinting. So we're going to say set movement status, e movement status, and we're going to say that it is normal because we should not be sprinting in that way. Are sprinting, animation will not be playing. So that takes care of the below minimum state now for the exhausted state. Now remember, if we drain our stamina down to zero, then we're going to transition to this exhausted state. And now in the exhausted state, we need to first of all, if key is down, if we shift gears down, then we're not going to be recharging our stamina and we're not going to be draining it. We're just going to have stamina equal to zero. And that's because we've reached the exhaustion point and we don't want to be running. We don't want our stamina to be recharging. If the shift key is down, we want the character to have to unpressed or lift up from the shift key in order to start recharging again. So if it's down, basically nothing happens. Stamina stays at zero else. And in this case, shift key is up. So we can copy this comment here so we can copy the comment. And if shift heat up, then we can set the stamina status and it's going to be stamina status and this time exhausted, recovering. So as soon as they let off on the shift key, when they're exhausted, then we can go back to the exhausted recovering and we can start recovering the stamina. So stamina plus equals Delta stamina. And as soon as we enter the exhausted recovering state, then we can also change the color of the bar to that nice orange orange color. So if we're exhausted recovering, that will happen. Now, if the chief down or the shift key is up and we're exhausted, it doesn't matter. We still only want to be not sprinting. So we're going to set the movement status to movement status. Normal, so we're not going to be sprinting when we're exhausted, OK, so that takes care of the exhausted. Now, what happens if we go into exhausted, recovering well and exhausted, recovering? We're basically we're exhausted. We're regaining stamina. So we should not be able to sprint. And also we need to check to see if recharging the stamina will put us back up into the normal state. So we're going to check to see if stamina plus delta stamina is greater than or equal to men sprint stamina. If that's the case, then we can set stamina status equal to E stamina, status normal. We can put us back into the normal state and we can simply increase stamina by Delta stamina. Now, if the if the in the case, if the stamina would not bring us into the normal state, then we simply just increment stamina by Delta stamina. And regardless of whether we're transitioning states, we're exhausted recovering, so we should not be able to sprint. So we're going to set movement status equal to e movement status. Normal, we're not going to be in the sprinting movement status and of course, let's see, it's saying I'm getting a error here and that's because I left out a T and now it's spelled correctly. OK, good. OK, so awesome. Now we have our logic for the states and this is going to take care of all this, all four states and what we should do if we're in those states. So let's go ahead and compile this and give it a second to load and then we'll go back into Unreal Engine. And that's where the real magic will happen with our our stamina bar. OK, looks like I have an error here. Let's go back to Main. It says to have an error on line three. So down here in line thirty three. And that's the generated body. And that means something happened up previously to make this happen. And I think I see it right here on SS Max. The last anum constant. There's this and this comes from copying and pasting things. It's still has this, this comma here. So it's expecting something else. If I remove the comma, that should take care of it. So I'm going to remove the comma and build again. OK, and it looks like there's another one main, that zip line. Thirty to it. It looks like I put a double equals when I should have put a equals sign. So let's go to line sixty two and check that out and yes sure enough I did. So that takes care of that one. And then another has to do with a deal so that might be taken care. Let's go ahead and build this and it looks like that takes care of all errors so we can go back into unreal engine. OK, so we now need to check out the stamina bar. Now remember, we set the movement status based on whatever state we're in, so this actually should update. So we should be able to actually transition into the sprinting state so we can actually test that right off the bat. So let's click save all in click play. And it looks like hitting the shift key. So I I'm not sure what's going on here, but I'm going to click save all and close the Ed and recompile control F five to launch the Ed from Visual Studio. And it looks like it wants to rebuild the files. I'm going to click. Yes. OK, so we've regenerated the files. I'm going to click play. I'm running and I'm going to go ahead and hold shift and we're sprinting. So it's looking good. And also the stamina bar is draining now. So we've already been down to the stamina bar to the percent. We've already bound at the percent. And it also looks like if we go all the way down, then he will stop sprinting. So that's good. So we've taken care of that. Now we need to bind the color and so in to the stamina bar widget, we need to go. So let's hit escape and let's go to the HUD folder and let's go to Stan in a bar and we're going to create a binding for the progress bar color. So if we click on anywhere in here or click on Progress Bar, we can scroll down to fill color and opacity and you'll notice that we have the option to bind. So if we click, bind and create binding, we create this function to bind to the opacity, the full color and opacity, rather. So I'm going to rename this and take out the underscore zero. And so now it's just full color and opacity. Now, over here in the My blueprint, under the variables will see that we have the variable reft to Maine. We also have a variable for the progress bar. It's just it's just named progress bar zero by default. What I'd like to do is I'd like to add a couple of parameters here. Now, look at our return node. If you hover over it, it's a linear color structure. So there's basically something called a linear color and that linear color, whatever we plug into here, that's what the color is bound to. Now we can create new variables of type, linear color. And I'd like to do that for the different various states that we're in. So we're going to have various colors corresponding to the state and we can basically set those colors here. So what I'd like to do is click, add new and variable and it creates a new variable and let's click the dropdown and type in linear color. And here we can select a linear color. Now this linear color variable I'm going to call normal. And if you compile, then suddenly down here you'll see that we can give this a default value for normal. So if we click on this, then we can suddenly choose what the color is for this normal variable by default. Now, by default, everything is zero, including the alpha. So if you don't select Alpha and make it a one very important, then it'll be transparent and you won't be able to see anything. Now, stamina for the normal state. I'm going to want it to be a sort of light blue. So I'm going to drag this over here up all the way and put this about there. I think this kind of light blue color looks pretty good. Choose a color you like. I'm going to choose this and click, OK? And that's going to be the normal color for the normal state. So that's that one. I'm going to click add new variable. And since the last thing we added was a linear color, then this one is by default, linear color. And I can rename this one and this one's going to be the below minimum color. So I'm going to say below minimum, I'm going to compile so I can get this option to set a default value and I'm going to set the Alpha to one. And for below minimum, I'm going to give this more of a sort of yellow state color. So I'm going to put it about right there. Click, OK, and I think that's good. I'm going to add a new variable of type linear color, and I'm going to call this one exhausted, recovering. And for exhausted recovering, let's compile click on the default value thing here and let's make this go up to all the way up here on the right so it's not black. Let's give the alpha a value of one, and I'm going to give this one more of an orange kind of color. In fact, I want to drag this right section down a little bit, put this maybe more into the almost red, something like like that, actually, maybe a little closer to the yellow side, something like a burnt orange ish, sort of like our sketch and paint. So I want to give it that for the exhausted recovering color. And so we have these different variables. And what I'd like to do is we can only plug one of these in to return node return node. It only takes a single color. So I'm going to create a new color variable called stamina by color. And this will be the actual stamina bar color we plug in here at the end. So I'm going to click this and I'm going to actually drag it in and plug that in. So what we need to do here in the functionality is to set the correct color depending on our state. And to do that, we need RF to main our main character reference. So I'm going to hold alt and drag it in. That will give us a setter and I'm going to put it down there at the bottom and I'm going to hold control and drag it in. That will get us a getter. And first and foremost, I'm going to check to see if Reft to Maine is valid. So is valid with the question mark will get that node and we'll drag on the execution pin. And right off the bat, if it's not valid for the is not valid node, what I need to do is get the player porn's so get player porn and we can drag off of get player porn and cast to main BP. We can convert this to a pure cast if we want to do that. That way we don't need the execution pin. And as main BP, we can get the return value and use that for set reft in Maine and if is not valid, then we need to drag that execution pin in there. And so from there we can just simply drag this to the return node and will basically be giving this stamp in a bar color value into the return node for this particular instance, this particular time. And so really to give it a default value, we can just drag in. We can AWALT drag and stamina bar color and we can control drag and normal, and then we can set stamina bar color here and actually just drag this ref to main into the set node here and we can drag this into the return value. So basically in this case, if we're have to main is not valid. We get the player and cast it to main set Reft to main and then set stamina bar color equal to just to the default normal color. And we simply return with that particular we we return with whatever standard about color is in this case it's normal. OK, but that's the edge case. That's the case when reft to Maine is not valid. But Reft to Maine should be valid most of the time. So what do we do when we have to is indeed valid? Well, in that case we can access all of the enum states and we can do something based on that. So I'm going to drag out Reft to Maine. I'm going to control Drag to get getter to it and drag off of Reft to Maine and get movement status. So get movement status and we have our movement status. Anum now, just like in C++, we can do switch statements here in blueprint's. So if we drag off of this, we can type switch and you'll see switch on e movement status. That's the same thing as having a switch statement in C++ only it's a blueprint node. And I'm actually noticing that this is tipping me off only to status states. That's because movement status is not what we're binding this color to or binding it to stamina status. So drag off of ref to mean and type stamina status and get stamina, status and from stamina status will type switch and we will do a switch on stamina's status. So here is our switch statement. Now, if Maine is valid, will drag this in and we'll do a switch and then this switch will do something different depending on what stamina's status is. What we want to do, depending on the status, is set the stamina bar color equal to a particular value. So let's go ahead and AWALT and. Ragga stamina, bar color, we'll get a sitter for that and on the case that the stamina status is equal to normal, then we need to set stamina bar color equal to normal. So let's drag again normal right into there and set it. Now you can click on Stamina Bar, color the set note, and if you put your mouse down just below it, you can control W, and that's the same thing as copying and pasting, as I've mentioned in previous videos. Now if we're in below minimum stage, then we need to set Stammen a bar color and to our below minimum colors will drag that one in there and these can get quite unwieldy very quickly. So it's important to keep these nice and orderly. There are different styles for blueprint ordering, but I like to do something that looks sort of like this. So it's kind of conveniently stacked on top of each other. And because we have multiple nodes, we have a node, a line of execution going into the return node from down here. I'd like to re I'd like to give this a re-route node and you do that by double clicking on it and you'll get this little re-route node that allows you to make this a little bit more manageable. OK, so we've got the stamina bar colorful for below minimum amount of control w to copy this and drag in exhausted and then we have a exhausted color now exhausted is basically when the in a bar is all the way drained down to zero. So it doesn't matter what color we have for this. So we can really drag in anything we can drag in normal if we want it to. Now, exhausted, recovering, on the other hand, is when our stamina bar should be orange, and that's our exhausted recovering color note here. So I'm going to set that one there and I'm going to drag an exhausted recovering. OK, so we switch on the stamina status and we change stamina, bar color to particular value depending on the value of stamina, status. And after setting the color, whichever route we've taken, we all always need to return to the return node. So I'm going to drag all of these and plug them into a return node. Just like so so we've got multiple nodes going, multiple lines of execution going into the return node and of course the default is setting it to normal. If Main is invalid, if RF to mean holds basically a null pointer, then we'll cast and get that and set to the player pawn, cast it to mean BP and then set it to normal. But that should only happen in the very edge case where Repton Main is not set, but it should be set in most of the time. All right. So that should bind our color. Let's compile and save this and we can do some testing out now. So let's go ahead. And first of all, click save all. In the case of a crash, we don't want to lose our progress. And that's generally a good idea. After doing a big change like that, always click save all. And that way, if the editor crashes for some sort of mistake or any other reason, then you haven't lost your progress. OK, so we've got play it it it's started rejuvenating right off the bat, so that's good. We can run and hold shift and it's draining now. Let's see if we get it down past that. There it is. It's yellow and we've reached the looks like the exhausted state. I'm holding shift down. If I lift shift then it regains all the way up to to where it changes to the normal state again. Now, if I'm in the yellow state and I hold shift and release it and repeatedly press the button, then we can change from normal to sprinting as we please. But as soon as I hit the exhausted state, then I can't go back until we've reached the normal state from exhausted recovering. So give it a try. Go all the way down to exhausted and then as it's in there, exhausted, recovering state. Go ahead and try to spread. You'll see that you can't until you finally reach the blue, in which case you can finally sprint again. So this is a good way to implement the stamina mechanic and it basically limits it so that you can't just unlimited sprint as long as you want to throughout the game. You have to be smart about the times which you choose to sprint. So that's a good way to limit things like, you know, abilities like that. So let's go ahead and hit escape. And one thing I'd like to do just before we wrap this up is I'm going to go to the HUD overlay and this is bugging me a little bit. I think that these bars look a little a little funky the way they look right here. What I'd like to do is go to this top box here and I'd like to give it a little bit more padding. So let's go to here on the bottom here and let's give it padding. I'm going to try forty here, not for point oh, but 40. And it looks like I've actually haven't really affected the standard of bars. I want it to affect the stamina bar. So let's put a zero there and let's go one box and stand in a bar. That's the stamina. A box here. And for the bottom padding, let's give it something like 40. There we go. Now it's going to squish it up a little bit. And because these are filling, then they're both affected. So I think that looks pretty good. I'm going to compile and save that, close it and go to play. And there we go. I think that looks a lot better. And you can go in and tweak these as you wish. But yeah, I think this looks pretty good. I personally prefer it to be a little thinner like that. So that is the stamina bar. So quite a bit more involved with the stamina bar than was with health. Health is simply, you know, increment or decrement. We currently don't have any health buffs, but you know how to make pickups. You can easily create one of those for your game. And, you know, sprinting has to do with rates, draining rates, recovery rates. So we had to implement this in the tick. We had to create some new states. So we learn how to do in rooms in C++ and Unreal Engine. And we also learned about using switch statements and blueprints based on our C++. OENOMAUS So we've made a lot of progress. So pat yourself on the back. This is really, really good progress and you're going to get deeper into gameplay mechanics as we continue to flesh out this game and make the gameplay more exciting. So stay tuned that there's a lot of more exciting stuff to go.