In this lecture, we're starting to play around with sprite shapes, make a little bit of a level layout,
and to play around with the nodes in sprite shapes to make some jump.
So let's get started.
Let's start this process by making ourselves a new project.
So Open Up Unity Hub, click on the new button will make a 2D project.
I'm going to name mine Snowboard Dir and I'll save it in my repos unity 2D folder.
Click on create and wait a moment for it to work its magic just there.
While you are waiting for it to fire up, you can go to the resources against this lecture and download
the snowboarder sprite assets will be needing those in a moment, so that'll either be to the right
of this video or underneath this video you'll find the the resources and grab the download of the snowboarder
sprite assets.
Okay, that'll bring us to our new project.
I'm going to grab my game window and just dock it next to my scene window so I can see these two side
by side.
Sometimes I'll pop that and say, I don't need you as much.
Sometimes I'll drag it over and say, I need you more.
But generally I like to be able to see them both because here I can see what I'm creating in my scene
and over here in the game window I can see how it's going to look in the game camera.
Now that file that I suggested you download, we're going to go and find that will unzip that because
it's a zip file on windows.
You can do that by right clicking, extract all and extract.
I believe on Mac there's a similar process where you can easily unzip that.
You can see now we've got our snowboarder sprite assets.
I'm going to drag that down into my project just over the assets area that should work just fine release
and then it will bring this import unity package window is going to click on import that will bring
that into our game and it's probably in a folder called Sprites and in here it'd just give it a moment
to think about things.
It's going to go pop.
There we go.
It goes pop.
You can see I've got the top and bottom part of my snowboarder.
I've got a couple of trees, I've got a snow tile, low rez.
That's an important one for this lecture and then some clouds as well.
A couple of things in there.
Okay.
So now we've got our assets.
What we want to do is create ourselves a sprite shape.
So I'm going to hop into the hierarchy, right click, find 2D object, and then you'll see Sprite Shape
and we're going to create ourselves a closed shape.
So we want it to make a complete loop the whole way around.
If we went for an open shape, that would be something if we just wanted, say, a wall that didn't
make a complete circle.
But for us, we want to be able to fill the inside of it.
So we'll be using a closed shape.
You see in here we've got this white thing.
It looks a bit odd, looks like a tank track actually from the side.
And we've got some handles we can move around.
So, so far good.
We've got something in our scene.
If you hop over onto the right hand side in the inspector, you'll see the sprite shape controller has
been added and it's automatically got a sprite shape profile as defaulted.
That's the default one that's hidden somewhere in our packages, somewhere we could find it if we clicked
on that.
But that's a default, one that comes with our sprite shape.
So I don't want to go and modify that one.
I don't want to modify what's in the package.
So I'm going to click in my assets directory here, jump into the sprites folder because I find there's
a jump into the sprites folder and within here right click and create and we'll find ourselves up in
2D.
You'll see that there is a Sprite shape profile and I'm going to click on it and there's some information
coming up in the inspector, but I just want to rename it.
So hit F2 on your keyboard or you can slowly click twice on the words that gets there as well.
And I'm going to rename this to B Snow Profile just so it's very clear, we've differentiated it from
the default one that's hidden down in the packages.
Now if I click back over on my closed sprite shape, you can see here within my Sprite shape controller
profile, I'm going to drag my snow profile over to that box.
And now we're using the snow profile.
So we're using the one that we've created ourselves.
Well, I'm here instead of closed sprite shape.
I'm going to rename this to B level Sprite Shape.
Now, the first thing we want to play around with is our snow profile.
So if you have a look in here, there's a bunch of information going on.
First of all, you can grab this little blue thingy and swing it around.
We're not going to be doing much of that or if any of that in this project.
But what it's showing here is what's the orientation as you move around in the world?
So you can see we've got our sprite shape here, we've got the top, we've got the side and we've got
the bottom.
And if we look in closely, this will become a lot clearer in a moment.
But we've got an edge.
You can see where that line is and then it's filled in the middle.
So we've got edge and fill.
And if I click back on my snow profile here, it's saying, How should the top edge look and how should
the right hand edge and the bottom edge and the left edge?
We're going to have them all exactly the same for us.
That's not going to matter.
But in the future, you might want to say, well, the top of my world looks different to the bottom
of my world.
And if that's the case, what you can do is go down and fill in all this particular information in terms
of what happens in the outer top left, the outer top right there in the bottom left, what happens
in all of those corners.
But for now, we're not going to dive into that too much.
But I'm pointing it out so you can see it and it's demystified a little bit.
And if you wanted to make those changes, you absolutely could.
For us, we're going to have one overall shape that we're using for our edge.
It's defaulting to this white thing here.
We're going to use our snow tile low res.
So just grab that and drag that over the top of where it says sprites.
And we've currently got the sprite shape edge, drag it in there and bam, you can see that all of a
sudden the whole way around the outside of our shape has that snow tile.
Now we've got this kind of white blob in the middle instead of the white blob.
I want this blue to continue.
So you see the texture for the sprite shape fill because we're using a closed shape.
I'm going to grab the blue fill and drag that over to the sprite shape fill.
And now it looks like it's nice and closed.
Excellent.
So this is a good starting point.
And you can see if we zoom out a little bit, this is where our camera currently thinks we want to look.
So we get a little bit of a perspective of the size of our world.
This is not the entire world here.
This is just a little one aspect of it.
So we want to make our Sprite shape bigger.
I'm going to click on the Sprite shape within my scene window.
We get some information over on the Sprite Shape controller.
I can click on edit spline and now you can see there's four dots just here.
This is where the magic happens, my friend.
If you click on one of those dots and move it, we can move our shape organically and our texture updates,
which is really super cool.
Move it and updates.
Move it.
Updates.
Nice, wonderful.
You might say, but I want more than four dots in my world for four points.
So just click anywhere.
It'll create a new node or a new point.
So click, click, click, and I can drag this out to the side.
Drag, drag, drag doesn't really matter what happens down the bottom.
The play is not going to be seeing it.
We're not going to be cruising along there.
But I'm just going to drag this out to make a bigger world, a bigger kind of playing level, if you
will.
Remember, this is the size of one window where our camera is.
And you can see over here, this is one size and I'm going to move this one node all the way over to
here.
That seems fine for a start of a level, this one all the way over there.
That seems fine for the end of the level.
For now, we can tune this and I'm going to move this one over there just to make a big shape so the
player's never seen the bottom.
I'm going to do another click just here.
Move that down below and move this one over to the left a little bit.
There we go.
So I've just kind of got a big old boxy kind of thing.
Now let me show you how the handles work.
If you've done any sort of vector manipulation, you'll be familiar with this.
But if I make a new node clunk, you can see there's a yellow handle on either side.
If I grab those that allows me to change how this curve takes place, I can move them in and out and
you can see it changes the where the center point of the curve is happening.
If it's very close to this node, then the angle is very close to the node as well.
If I move the handle out further than it pushes where that curve central point is taking place.
Okay, so I'm just going to move things around a little bit here.
Actually, you know what?
It's time for challenge.
Let's make ourselves a little bit of a very basic level by adding in new nodes and by moving these handles,
we'll make some jumps and stuff.
Just one thing I'll show you first is if you go and add a node and you're like, Oh, I didn't want
that node, just hit delete.
So select a node by clicking on it.
Hit delete.
If you click somewhere else in your world, or if you click on, say, a different game object, you
might lose all of your information as clicked back on your sprite shape and then click back on edit
spline.
That's important.
That will bring up all of these particular nodes.
So a quick challenge make a simple level, modify your sprite shape to create a simple layout that might
be good for snowboarding and doing jumps and stuff.
Don't spend too much time on it just yet.
Just something to test our gameplay so that we can get a feel for sizes and shapes.
We absolutely will be changing this again in the future, so just pause the video and play around with
your sprite shape to make a little bit of a level.
Okay.
Welcome back.
Let me show you what I'm going to do.
I'm going to have a little bit of a start that is slightly flat, I think.
And then we'll get into the jumps, we'll stretch out our nodes.
I'll do this quickly.
I might even speed up the video so that you don't have to watch me place every single one of these,
but basically getting enough nodes so I can have some jumpy type things in there and then playing around
with the handle.
So you can see that's got a nice whoop up and then spin, spin and land.
I like that shape to it.
Maybe a little bit of a jump over a gap.
So you get enough speed and then enough speed and then hopefully you jump over that gap and then land
there smoothly, a little bit of a downhill.
And then yeah, I'm just going to go and Chuck in a few more jumps and bumps and stuff.
Like I said before, nothing to fancy, just going through the process nice and swiftly at the moment.
So there we go.
You can see the general shape of my level.
This technique using sprite shapes is really, really powerful for making platformers as well.
So I know we're making a bit of a snowboarding game.
Could also be a cycling game.
If you remember the old Cyclo Maniacs game, it's a classic, but this is a technique using sprite shapes
that's really, really handy for a lot of side scrolling platformer type games in Unity.
So there we go.
Great work in this lecture.
I will see you in the next one.