Welcome back my fellow game developers
to a brand new video.
And this one, we don't do anything very fancy.
We create a new scene.
We have a shopping scene right now,
and as you can see, we have three items in here.
They are very identical.
They don't do anything special,
but this is just the setup for
the next video where we will
start actually creating things.
So let's not waste any more time and let's get started.
Okay, so now time to create a shop.
And to create a shop,
I wanted to make it a separate scene all on its own.
That way we are inspired by the game Hades.
We can go from one scene to the next ghetto,
a shop, shop there then grow to the other scenes.
So what I'm going to do is I'm going
to duplicate the level two.
And now we have level three
and I'm going to call this the shop,
can call this the shop level or shop scene or whatever.
So I'm going to double-click and you can
see that even though it's the same,
but we are on the shop right now,
up here in the hierarchy.
So I'm going to first of all delete
the Bitcoin, delete the weapon,
shes the health pickups
by dropped the breakable bought and
let's open the room and let's go ahead and
delete all the enemies.
I'm just going to remove them from
here and just keep this room as it is.
I believe we will make this a prefab and
be able to add it to any room we want.
But anyways, later on we'll think about that.
But for now we'll just delete
all the enemies and will cause this will keep the layer,
will keep the portal obviously because
we want to get out of the shop later on.
And I'm going to right-click in here
and create an empty game object,
which is going to be the shop item.
And we're going to start off with health.
There we go. So we are going to mainly
have three shop items to focus on right now.
Where we get health 14, the upgrade health,
and want to buy some kind of weapon,
a random woman, I think.
So. Let's set these three.
So we're going to have one here,
one here, and one here.
Let's start off with the most simple one,
which is the regular sharp item.
I'm going to add a component in here which
is going to be a sprite.
Or know what, maybe we want to go in the ER,
know what, let's just add a sprite for now.
So a sprite renderer.
And we are going to go in the sprites
in the, Where is it?
Oh, so pickups. And there we go.
This is the health. And I'm
going to just add the sprite right here.
And we're going to set it on the player layer,
even though we said that we
will not be doing this anymore.
But anyways, let's continue on.
Then we are obviously going to add a box collider 2D,
and this will be a trigger.
So whereas it is a trigger,
Let's see the size and obviously
we want to make it a lot bigger.
So that way the player can step in here.
And we will have, for example,
when declare steps in the vicinity of this shopping item,
he is going to receive a message appear.
We will also add a canvas and
just a bit where he will read.
You can buy this item, for example,
a health or replenish your health for,
let's say, 50 coins.
And this will appear only when the player stands near
the button or the sharp item or whatever.
And we also want to create
a small box collider that will make
sure that we do not hit this actual object.
So a second box collider,
we'll just make it a bit smaller to just be
enough so we don't hit the actual object in here.
There we go, close that, save that.
And now what we're going to do is
we'll add a canvas to this.
So we'll go to the UI.
We'll add a, where is it the canvas.
And we'll call this D sharp item Canvas.
And we are going to set,
we want to see the UI,
okay, So we can't see the UI.
Where is it? This Is it,
the big giant canvas?
Let's turn on the gizmos.
And it's not allowing me to remove
the scale because we need to set it to world space.
And zero-zero point five on the x-axis,
zero-zero point five on the y-axis.
And let's reset its position to 0.
Now double-click on the shop item, and there we go.
Now we have the little canvas around here.
And let's just set it bow.
Yeah, I think that's good enough up here.
And we're going to add, first of all,
a visit to texts.
So we're going to go to UI text much Pro.
This is the first one.
This is for the,
let's say the press press button, text.
And another one which is going to be the
Whereas it, this will
be the text that represents the price of the item.
So item, item for ice text.
There we go. And I'm going to move
this one down and move this one up.
And let's do a couple of editing and make this bigger.
Press.
E to buy.
And scroll down a new set it in
the middle and make sure that it auto sizes.
And we'll also turn this down.
We don't want to see this and make it
bold, make it robot.
And we can't see it because we need
to go into the canvas and the
sorting layer and set it on the player.
There we go. So now we can see everything.
And now back in the button,
this is the perfect fit.
Well, I think we can increase the max.
So when you press on the opposite side,
you have the options right here
to auto size option the minimum,
the maximum, and whatever these are.
So I just increased the maximum to fill up
the whole space in here. There we go.
And now back in the price item, you know what,
let me just delete this one and then duplicate this one.
And now we move it down.
This will be, let's say, price two buttons.
And then we can say,
for example, 99, 99 coins.
There we go. So as you can see right now is a table.
Maybe it is a bit big,
but no worries about that.
We can actually decrease the sizes of these
two because they seem a bit too bulky.
So there we go. Something like that.
And this one also Something like that.
Yeah, Sure. Why not?
So take your time to create all of these,
make sure that they look really good for your own sake.
And finally, I want to add
some kind of platform under the soul,
the player or whoever is playing your game doesn't just
confuse this for some kind of item on the ground.
So I'm going to go into my resources
and I have this some kind of teleport,
I'm going to use it as the platform.
So let's drag it into the sprites right here.
And it's annoying when we have the files so small.
So right-click in here,
create the shop platform.
And let's add it in here.
And we have this right now.
So I'm going to make it a multiple,
make it point, apply the changes go Sprite Editor.
And how are we going to slice this baby up?
Let's see, I believe this as a one of the bigger sprites.
So you can see right here that it's 128 by 320.
So back in the Sprite Editor,
I think let's try automatic.
Yeah, sure why not? Automatic seems good.
If you want, you can go ahead and
create animations for this.
I do recommend it so you can play all the time.
Maybe we will do this.
So I'm going to go back into the item right here.
And let's just add this teleport.
There we go. So this will be the item plat form.
And we should set it on the layer,
layer. It's very small.
So we are going to go in the, where is it?
Okay, So here, let's make it 50.
See how that looks.
Let's make it even bigger.
25. Now that we have 25.
Nope, that's a bit too big.
Now.
What's between 25 and 50?
That's truck 14.
Apply. Great. So 40 seems to be
the right size and I'm going
to set it to 00 and then move it down a bit.
Well, let's keep it. Maybe if you want,
you can start moving this up and down.
And but I'm just going
to keep it as it is for the button,
maybe want to rotate it.
I recommend you do that.
But remember that if you want to move
the actual plus in here,
the green plus, you need to make sure to
set it as a separate object.
Because if we move this one around,
look what happens on the wide, everything flips.
So you need to make sure if you want to
add some kind of animation to animate this also,
maybe I will in later on,
but for now let's focus on creating the actual item.
So I'm going to move this a bit down right here.
So there we go. So now we can see that this is an item.
I'm going to create a script in here that will be,
and the scripts, I'm going to make this a bit bigger.
And do we have anything?
Okay, so let's go ahead and right-click in
here and create a new folder.
And this will be for the shop.
And inside of your ongoing to create the shop item.
There we go. Wait for it to compile
and I'm going to know,
Thank you what this open.
And I'm going to add to the what's the matter.
So the new Unity is very awful.
It keeps crashing, keep stopping.
The loading of the game takes a lot of time.
Because the script cannot be found.
Excellent, Great.
So we have the script,
the script cannot be found.
Our case, obviously there is a problem.
Let me delete this.
Oh, so sorry.
It was because of me because I
just noticed as I'm deleting it,
that I added a space option,
sharp item, we cannot add
spaces in between them. So sharp item.
Now this should work. Okay, There we go.
So open the script up.
Now we have this sharp item.
Let me duplicate this once and twice.
And now we have these three items.
Let me move this a bit to
the left and move this one a bit also to the left.
And finally, this one also,
maybe we can make them a bit smaller,
but no worries for now,
we have these three items later on,
we will be changing them.
Obviously this will be
the health upgrade and this one will be the weapons.
Weapons hit Enter. I hope you enjoyed.
This was just the setup of our items.
In the next video, we'll be starting on
the whole process of scripting, changing behaviors.
And before I go, let me just create
an empty game object, reset its position.
And this will be
the shop items just so we
have a nice hierarchy in here for everything.
Save that.
And I'll see you in the next video.