Welcome back My favorite game developers
to a brand new video.
And in this one we pick up a couple of coins,
we get hit, we go down.
We can either restore
our health or we can upgrade our health.
So let's upgrade our health.
As you can see, it has,
the maximum has increased by ten,
and our health is now
full because that's our mechanic in the game.
So let's not waste any more time and let's get started.
Okay, so time to upgrade our health.
But before we do that,
there's something bothering me
and something that we need to fix.
First of all, let's turn on these three campuses in here.
And on each canvas I'm going to change the,
whatever the price in here says.
So for example, the price 999 instead we are going
to save this as the restore health.
Restore health.
And we'll say, how much did we say it costs?
How much is the cost of the health restore 10.
So in here, then BTC.
Okay, So in the second one,
it's going to be the upgrade.
So opens up, select the button,
let me close those down.
What was it? Upgrade health.
Upgrade, health.
And let's say this one will cost 30 BC.
And finally the new item,
let me close this down again and turn
these two canvases of and finally,
we have this one right here.
And this will be the by weapon or by weapon.
And this will be, let's say 40 BTC. There we go.
Now we have everything set up
properly At think in the next video,
I'll also maybe add a bit of animation to each of
these items and maybe something to the platform
just to give it a bit more life.
Okay, with that out of the way,
let's drop this back down.
But before we go, I want to
change the actual sprite in here.
And I've provided you with a couple of sprites.
So we have first of all, this one,
but honestly I found that a bit ugly.
So I also use these ones,
and it really depends on what you want your game to have.
You can see there is a lot of potions in here,
so I'm going to select the red.
And we have this thick glass
maybe should we use the thick glass?
Nope, let's just use the regular glass.
And I'm going to add it into the sprites in here.
So inside of sprites opens up bigger.
And let's go ahead
and right-click in here and maybe create
a separate folder for this or just added to
the pickups if we have some or something for the health.
Anything. Pickups? Yeah, sure.
That's added to the pickups. No worries about that.
Keep it in here.
I think this is a good place.
And then we are going to go into the item
upgrade and give it this one. There we go.
Nice.
Very big.
So I'm going to maybe make it 200,
apply, make it bi-linear point.
Apply. Still big.
400, 400 I think would be too small.
300 apply.
And the yep seems to be good enough.
Maybe we can move it up a bit.
But this is why I wanted to create
the actual item sprite in here for each one.
Now what? Let's go ahead and do that.
Some ongoing create the item sprite.
And it's always better to have
these bright on a different.
And what we can do is select in here
and click on Copy Component.
So copy components, select the item sprite
and select in here and basically component as new.
So now I can go back in here
and remove the component entirely.
And now this sprite is free to move up and down
and we can add some kind of animation to it freely.
So I'm going to copy this and paste it for
the first item and here.
And then for this one also in here.
And we should reset the position of each of those.
And for this one.
And in here, instead of having this red,
we are going to add the usual sprite that we're using.
And in here we'll just remove the component. There we go.
Excellent. So now we can control
this item sprite all on song.
And what else do we want to do?
And the last one in here, items private,
remove this item and electron and
the next video we'll be adding its own weapon.
Okay, So that out of the way,
also make sure to change
the box gliders on each one of those,
just so we don't collide with
the items with that out of the way.
Let's continue one and now it's
time for the health upgrade.
So let's go. First of all,
create a method and
the player health handler that will allow
us to increase the max level 2.
We have anything to do that? Nope, we don't.
So I'm going to add it right here.
So in here I'm going to create a public void.
Increase max.
What's that?
Max health.
And in here and the max health amount.
And then we are going to get the max health and
increase it by V-max health amount.
And then we are going to get
the current health and it's equal to the max health.
Or if you want, you can avoid this and not do this.
So we get an upgrade,
but we don't get any health.
Or for example, if you want,
you can set instead of the max health,
you can set the current health
plus 75 percent or something.
I believe this is something that happens in
Hades or you can increase it by
just ten or however you wanna do with,
I'll just keep it simple like here.
And then there is one more thing that we need to do,
and that is we need to go into
the UI Manager Door instance,
and we need to update The Wait a second,
whereas the UI Manager,
we need to update the half bar
so we need to make sure that it shows what's happening.
Increase the max value and
the value of our health in here,
in the UI Manager Instance,
we upgrade the max value,
which is the max health of the slider.
And this is important because this will
determine how the slugged works.
So after we upgrade the max health,
we need to go to the UI Manager dot instance,
dot health slider dot max value.
And it's going to be equal to the max Hello again.
So save that.
And we'll also make sure to update
the player health you are at the end.
Save that. Okay, great.
Now with that out of the way,
time to actually buy the item in here.
So I'm going to issue it to you as a challenge.
And that is to create
a another case for the health upgrade.
So create a new case that
takes the health upgrade item type.
Then you'll need to find the
player health system just like
with previously or if you're using the collision,
then finally increase the max health of our player.
Was that although the way pause the video right now
and go to the challenge.
Oh, hey, welcome back.
So back in the shop item in here
we have a another case that we're going
to call the case item type dot health upgrade.
And we are going to do the same.
We are going to find the layer health handler.
And then we are going to increase
the max health by how much do we increase the Mac South?
Let's just keep it at 10.
Keep things simple so we can easily
understand it and then we are going to break.
So back in our game,
Let's see, we said that this will cause 13 Bitcoins.
So anywhere let's make it 30.
Save that, run the game.
Now, we should see we pick up a couple of coins.
We can get hurt if you want. There we go.
So now we are at 200.
We can either restore
the health or we can upgrade our health.
So if I upgrade the health, There you go.
You can see that I have 310 now and I can also upgraded.
I can buy it but nothing gets upgraded.
If you think this is unfair
that we can actually buy the item,
but we don't get any benefit from it,
then be my guest.
I do recommend that you try to check, first of all,
before we increase the health,
do we actually have it at max?
If you do have it at max,
Let's not take it or not buy it or something like that.
So with that out of the way,
I hope you enjoy it and I'll see you in
the next one where we will be
actually buying the weapons.
Next, let's set it from now, 40. Save that.
And I'll see you then.
Oh, and don't forget to of
course commit your changes. See you in the next one.