Welcome back, My favorite game developers.
As you can see in this video,
we've created a simple scene.
We've added a simple background.
We've added a spreadsheet with called our little guy here,
Jimmy, maybe it will change his name.
I don't know. Maybe we'll call him doomed Jimmy.
But for now we have the Jimmy gameObject with a background of some kind of dungeon.
And we've, if we play the game,
you can see nothing happens,
but we at least have the spreadsheet and everything set up.
We've created a repository right here.
As you can see, the initial commit,
we've learned how to create a project using the new Unity Hub data.
So let's not waste any more time.
And let's get started.
Okay, so let's get started.
The first thing we're going to do is we're going to create a new project.
So as you can see right here,
we have the latest version of Unity Hub 3 better,
I just now loaded today.
So let's see how everything is set up.
And here we have the installs.
It's pretty similar to the previous versions of Unity Hub.
The only difference is if we go into the new project right here,
you can see that we have many ways of choosing the template that we want to use.
We have the version of Unity or
the editor version of Unity that we are going to be using.
And we have the different types of templates.
So this is a way to setup a project.
So for example, let's say you need a project that is 2D mobile.
This will set it up for you,
but of course you are going to need to download it.
But what we're going to do is we're going to choose a 2D core.
We're going to have the project name.
I'm going to call it the time.
But invader to the ROCC.
Like so you can choose whatever name you want for your game.
My game is going to be called the time bot invader because that's the story of my game.
So, and it's also a 2D, rock-like.
You choose whatever name suits your type of game.
I'm going to create a project.
This is going to take a bit of time.
So what I'm going to do is I will use the magic of editing to go to where
we have everything set up and we can start creating our game.
So I'll see you there.
Oh, okay, welcome back.
So now everything is set up.
The project is open.
We can start creating our game.
First thing we want to do is go into the game window.
And in here you can see that it's free aspect.
We don't want that. We want our game to be 16 by 9 or a 1920 by 10 ATP.
This is the standard resolution of most screens,
most PCs that are going to play this game.
So if you don't have this option right here,
you can click on the plus button and you can add your own using the fixed resolution.
So 1920 by 1080,
I'm just going to select it right here.
Now the resolution of our game window is fixed and we can go into
the scene and we can see everything right here in our sample scene.
You can see we have the main camera.
We have everything set up.
If we change the size of the scene window, nothing changes.
It stays 1920 by 1080.
Okay, great.
So now the first thing we want to do is
we want to add some interesting background to our game.
We don't want just to have this blue screen and be adding things to it.
So I'm going to go into my files in here.
I'm going to select the background and I'm going to drag it into the assets right here.
And now you can see that we have it,
just let's wait for it to import.
There we go. So I'm going to click on the background image.
And you can see right here in the Inspector,
we have a lot of information about it.
And you can see that it's a Sprite 2D.
Let's keep it at that.
But you can see the pixels per unit is 100 and there is a filter mode at now,
we are going to choose from bi-linear to point.
This means no filter because we already have a good-looking image.
And if we add the image in here,
you'll notice that it's very small.
So what we can do is we can click on the background and set
the pixels per unit to be 50 and apply that. And there you go.
You can see that it's much bigger now.
And we're just going to reset the position right here, 200.
So what we did, we just set the filter mode to no filter.
We've set the pixels per unit from 100 to 50,
and we applied all the changes and we just set the position and the middle.
So now if we go and click on the play button,
you'll notice that we no longer have just a blue background.
We actually have.
A pretty solid looking background.
Now, you can see that the edges are a bit outside of our game.
You can change that if you want.
Let's make this maybe a bit smaller so it fits exactly the way we wanted.
And we'll make sure that we also change the scale on the y.
So just copy the scale on the x-axis,
pasted on the y-axis.
And now if we go into the game,
you can see that we can see the edges,
although there is a small blue line up here.
If you have OCD like me,
we can actually change this bar moving just a little bit up.
So now we can paste it in here.
Is the game looking good?
Nope, still need a bit up.
There you go. Now, the game looks good enough.
Maybe you also need to change it down here.
Now the game looks perfect.
And we're just going to copy the scale on the y.
Copy that because when we go out of our play mode,
you can see that the scale goes back to normal,
which is not something that we want.
So now let's see,
the game and game mode looks perfect.
There we go. We save everything back in our scene.
We can see that the background has the correct different scale.
Let's continue on. The next thing we want to do is we want to add our player to the game.
So I'm going to go into my resources.
I'm going to choose the player versus player.
And we are going to choose the Xanax sheet.
Now you can see here that I have a different type of character.
We can also use this one if you want.
I've provided you that and the resources,
but I'm going to use this sheet right here because we are going to learn
how we can split up this sheet or slice up this sheet.
If you double-click, you can see that this is a regular image of a,
some kind of, I don't know, Butler,
this is the one we're going to use and I'm using it
from this Xenakis, ultimate smash friend.
It's by the rich red shrew-like, something like that.
Stephen Challenger from open game arm.com,
which is an amazing website.
You can get tons of free assets.
And here I always use it for almost all the assets that I have.
And you can go check out the exam Docs spreadsheet downloaded from here,
give some love and the comments to the creator of the sprite sheet.
But let's continue one.
What are we doing in here?
Why are we slicing?
And before all of that,
what is a sprite?
So let me explain what exactly a sprite is.
So I'm going to put on my laser.
A sprite is a to the object.
So just like we have the image that we've added right now,
this is something a bit different.
A sprite is a 2D object,
will delve deeper into what those are in the future.
They have graphical images on them called textures.
So if we go back in Unity right here,
you can see that we have this background, right?
And we also have a sprite renderer and a Sprite element in here,
which is the background.
If I set it to none,
you can see I still have the background object,
but there is no longer an image on it.
So I'm going to set this price of the background.
They are used by adding a component called a sprite renderer to a game object.
So just like you saw right now,
we have the background object and we've added a sprite render to it.
And on it we have the option to add a sprite.
Later on we'll see that we can add also layers
to the sprites so that they can render and front of each other.
So back in our game,
and here you can see that we have the Xanax sheet.
Now if we add it to our game,
you can see that we have this entire sheet and we don't want that.
We want to slice it up and have different types of animations for our exam,
I'm not sure how to even pronounce.
I'm just going to call this Jimmy.
This will be our gene.
So Jimmy, we're going to click in here.
We're going to look in the inspector.
We can see that we have our sprite mode and single,
that means this whole image is a single image.
But because we are going to be slicing it up,
we're going to make it a multiple.
So we choose multiple.
We click on Apply,
and then we go into the Sprite Editor right here.
We click on it.
And now we have the options to slice this baby up.
So how are we going to do this?
There are many ways of slicing a sprite.
Whenever we have a good position,
the sprite usually we can do it automatically.
So if we try to do it automatically,
as you can see, all the sprites haven't been sliced.
That's good. But that's not what we want exactly.
Because if, let's say we have the animation here which is the idle.
We have three animations,
which are the idol and we have three animation or for not animations.
This, this, these three images will create the animation of idle,
and these four images will create the animation of walking.
And those images will create the torpedo or the flipping or whatever.
But each of them have a different size and this
will be a big pain later on when we create our animations.
So our goal here is to slice them up exactly the same size all together.
And we can change the size of our slice by changing right here,
as you can see, the cut.
So I'm going to make this cut a bit smaller so we don't have the black rectangles.
As you can see, we've removed the black rectangles.
And in here also we've removed the black rectangles and same in here.
And I just want to keep this right now so I can
demonstrate what happens when we actually apply the slicing.
So right now I changed only this one.
You can see that the one with the idle still has black rectangles around it.
And all of these have also been sliced up.
So when we hit the apply key right here,
you can see it up. On the right.
We will close this window and we can open up the Jimmy sheet.
And you can see that right now we have all of these different slices from the sheep.
So we can add each one individually to our scene.
And you can see the camera hiding bead jimmy. There you go.
A very tiny small Jimmy.
And you can see him right here.
This is the cutoff,
the slice that we have just added.
And if we add the one with the rectangle,
you can see there is a rectangle around him which we do not want.
So I'm going to delete both of those.
I'm going to click on the panel sheet.
Again.
I'm going to go to the Sprite Editor and I'm going to slice up all those things properly.
Now, you can do this on your own. It's pretty easy.
I'm only going to change the squares right here.
So I'm going to make them smaller.
This one is for the idle.
So there you go.
I'm making it smaller so it fits the square.
We're not going to be using any of those two.
I'm going to delete everything that we are not
going to need and know these two we are going to need them.
So I just pressed Control Z to undo some of the things.
We're not going to use the flying,
but I do recommend the to keep some of the things that you might want to add.
So I'm going to slice all of these.
We're not going to be using the shooting animations we have here
because we are going to create our own shooting mechanics.
So I'm just selecting and deleting all of these.
You can keep this one for fun.
I mean, honestly, this looks so funny.
You can keep it for later use.
And finally, I'm going to change the torpedo in here.
So I'm going to also delete all of these.
I'm going to choose one of those boxes.
I'm going to duplicate it.
So the way we duplicated as Control D,
I'm going to make sure that all the slices have the same size.
So I'm going to choose one of those.
And I'm going to duplicate it again,
set it in here.
We need to make sure that all of them are on the same height.
So this one is 513.
And let's see if this fits all of the other.
Later on, you'll understand why we are doing this and why it's
so crucial to have all the slices be the same.
So I'm going to move this right here and this one.
So obviously we can see that all of these fit correctly except for this one.
So we need to make sure it's in here.
Let's see if it works on this one.
And it's a bit small as you can see, no,
it actually fits perfectly from top to bottom.
That's great.
And also try to make sure that the character is in the middle of this.
So I'm going to move this just a little bit to the left.
This one also.
And what's the height on those?
So lets see it's three, 513.
Let's copy that.
Okay. This one's correct.
Paste it in here.
Based on this one.
And based on this one.
And this one, we need to have them all the same height.
I can see that I have an extra box in here.
I'm going to delete it and now we have the proper cutouts that we need.
So the idle, the walking,
and the torpedo guy that we are going to use.
So I'm going to hit the apply key.
I'm going to look, there you go.
Now we have everything set up.
I'm going to use one of the,
let's see which one is the either 0.
And also one more thing that I forgot to say,
we can actually change the name so I can change this name to idle one.
I do.
Idle three, and so on.
We can change all of those for now.
They are just called the examiner ten,
Example 2 and so on.
I'm just going to keep them as they are.
This is not a very important step,
but I just wanted to make sure that you know what is happening.
So we are going to,
of course, it will ask us to save.
Let's just hit the apply right here.
Always remember to apply.
And now we can add the idle one.
And here you can see it's extremely small.
How do we make it bigger?
Well, just as we did with the background,
we can click in here and we can change the pixels per size.
This will be your task. We can change it.
Let's set it to 15.
Where did it go?
Oh, so disappeared.
Why is that?
Why is it not showing anymore?
That's a tricky question.
We will deal with that later on.
But for now, let's just try to make it as big as we can.
So maybe 50 is still a bit small.
Let's make it 32. So I think 32 is big enough 0,
so at appeared in front.
Why, why is it appearing sometimes in France, sometimes in the back.
How can we fix this?
Don't worry, we will fix all of those in the future.
So I think 32 is a pretty decent size.
Maybe just maybe we'll make it 28.
So okay.
I think 28 is enough,
maybe even a bit big.
We'll see later on, I'll change it back to 32, maybe 30.
I'm not sure. I don't even know.
Of course, take the time to understand how you want to set it up.
But until then before I go, let me issue.
You ate small challenge and your challenge is going to be to create your own player.
So explore open game r.org or you can also find a lot of great game assets on HI dot io.
These are amazing websites.
Most of the assets are for free and you can use them.
Find some characters and sprites that suit your style.
So as you can see, I've added my own background image.
You can maybe find a different area where you want your player to be battling.
Add them to your game and chop up the sprites,
just as we learned in this video, and that's it.
So pause the video right now and go do the each challenge case.
So before I go,
the last thing that we need to do is to create a repository.
So we've already learned how to download source tree,
how to add everything.
The last thing we're going to do is we're going to hit
the Create or you can open a new tab at the brows.
Let's see an Unity projects.
Where did we save it?
We forgot where we saved all.
Let's see, Unity projects backup.
There we go. Find bought invader to the row
like this is where we're going to select the folder.
We're going to create a repository.
Yes.
And as you can see,
everything in here is set up as we learned,
we need to make sure that we have to ignore the libraries.
So right-click, ignore everything on the library.
Okay, so now we have the gitignore file.
We're going to open it up.
We're going to get that's fine.
Git. Ignore. There we go, the masters.
And we're just going to click on row.
Control, a copy of that back in here.
Select everything control V.
Save that.
Back. Here, you can see that the gitignore file has changed,
so everything that we don't need has been removed and will not be saved.
We're going to stage all of that.
We're going to commit our work and this will be the initial commit of our game.
Commit our changes, go to the masters,
and there we go,
We are set up for our journey.
This is so exciting.
This is the first time you create a project.
Truly, this is very exciting.
So I hope you do the challenge.
Find your own sprites,
make sure to always commit the changes is very important.
You will understand why later on in your game development journey,
you will thank me, trust me,
and I'll see you in the next video.