Hello, guys.
In this video, we're going to create level parts.
I'm just going to give you an instructions and some advice on how to do it and what you could do to
make it better.
But in general, please don't sweat it out.
It's your first game.
Probably it's your first game and it's okay.
Whatever you do is going to be fine.
It's going to be cool.
I'm telling you, you're going to show it to your friends or family or as a school project.
And I'm sure people are going to be surprised and shocked of what you did because this would happen
to me when I made my first game.
I just shocked everyone around me.
All right.
First, what I want to do is tidy up a bit.
Let's take our script and drag them to the script folder just like that.
Now let's go to prefab.
As God told Prefab.
And I can see I narrowed down the size of the platform.
Right.
This is just one square size 4x4.
And I have a reason for that.
I'm going to tell you in a second before we continue and before we start making platforms, I just want
to do a couple of adjustments to make this level part creation easier for us as for developers.
All right.
So what I'm going to do here, I want to take my level part and add the component new script that I'm
going to call limiter gizmos.
Right.
Let's open it inside.
I want to create a couple of transforms so I serialize field private transform.
It's going to be a start.
Then another one with the name end and another one going to duplicate this one and name it as.
Let's say.
Ground level.
Now let's make Android gizmos function.
What I'm going to do here.
I want to just draw a line from the start point up and down and line from the end point up and down
and line from the ground level to left and right.
Very simple stuff.
Use mass.
Don't draw a line on let's make it red color so it gives us the color equals to color.
Dot red gives us draw line from start position to new vector to start position.
Plus let's say our position dot x plus 1000 on the Y is going to be the same and let's duplicate it
and make it minus thousand.
Cool.
Now let's take these two and duplicate them as well.
But it's going to be not start point, it's going to be end point.
So we need to change it here and.
And and here my intel sense should get what I'm trying to do and kind of help me so I can just now press
tab to do all the field.
And for here as well.
Again.
Very cool.
Right.
And we need to make same for our ground level.
But this time.
Oh, wait a second.
I did a mistake here.
Al, man, this should be for the Y, not for the X.
Just like that.
Sorry.
I was busy talking, and I just.
I just.
It was just out of biology.
I forgot what I'm doing.
Okay.
And I make it pretty now for the round level.
It should be on the X.
So here we do ground level position to new vector tool with the ground level position that x.
Here as well.
Ground level.
Position X.
Just one more.
Ground level.
Yeah.
Okay.
So this one we have now, we take in start position and draw in gizmos to the up and down and position
up and down and then ground level right and left.
Now, let's see how it looks.
You're going to go back to Unity, to our level part.
Assign start point and point and create MT.
Mm.
I'll just call it Limiter.
Okay, so this is our.
Sorry.
So this is our limiter.
We're going to see where we need to place it right now.
This is our start point, and it's kind of easier to understand now where level begins, where our level
ends.
Right now, let's do the limiter.
What I want to do with this limiter.
Let me make this platform long.
So what I want to do with this limiter, I want to kind of help myself to understand what is the lowest
point I can place platform on.
Right?
And for that, I'm going to set limiter to zero and I'm going to start my game.
So I have this red line.
I can see it and it's kind of high.
I still have space below.
So I'm going to take this platform and I'm going to try to pull it down even lower.
Lower.
So I guess this would be the lowest point.
I want to have my platform right.
Lower.
I cannot see the character and maybe it's kind of too much.
So somewhere here or even.
Yeah, let's say somewhere here.
Now I'm going to take my limiter and I'm going to place it where I want it to.
So there should be my platform at this level.
I'm going to see the number -1.68.
I kind of don't like the number, so I'll do 75.
Yeah, and that is okay, I guess.
Now let's go back to level part.
Over here.
Take the limiter and set.
-1.75.
Now, I know this is the lowest level I want my platforms to be on.
I can place it higher.
It's okay, but I don't want to place it lower if I don't want to lose view of the character.
Good.
Now, next step would be just to place the platforms.
But before we do that, I want to adjust something with coins and traps.
Currently, if I place my coin generator like this.
I can see the gizmos, but if I just put my mouse a bit further, I cannot see the gizmos and I cannot
see where are my coins.
So I want to fix that.
What I want to do with this is sorry for moving windows here and there.
I'm just trying to find the balance.
I have only one screen, very small screen on the laptop.
I use it on purpose just to prove that you don't need a monitor or two big screens to make games.
Now, let's go to coin generator over here.
Create empty object.
I'm going to call it coin image.
We're going to add Sprite Renderer.
Sprite renderer.
I'm going to go to graphics and drag coin over here.
Now we have it.
I want to make smaller scale point eight and I want to do like a couple of more plays.
First one on minus one on the X.
The second one on the one on the X, go back and it was saved.
And if I go back to level part, I can see now where my coin is going to be.
If you want, you can place just a couple of more.
Just put this one.
On minus two and this one on two.
Now let's switch images off because we don't need them here.
Let's go to code generator.
I'm going to close all by this.
And in the beginning I want to do serialize field private Sprite renderer.
It's going to be an array of coin image.
And then in the start, I'm going to do another for loop.
That works until we have images in coin image, coin image links and it's going to do this coin image.
I sprite equals to null.
So we're going to set Sprite to null.
It's going to have no image and it's going to disappear from the scene and it will be there only when
we use an editor.
But when you play the game, it's not going to be there.
This is basically what we're going to do in the code.
We're going to set the sprite to null.
Then let's open this coin image, drag them.
We can click, lock it over here, drag our coin images over here, and that's it.
It's going to be disabled once we go to play mode.
Now this how is going to look?
And this is much better.
If I want to zoom out, I still can see the coins and something else about traps.
So currently we spawn traps and they will be there for sure.
But I want to make a bit of randomness to this.
So what I want to do here is to go to trap code over here.
I want to create a serialized field protected.
So we can inherit it.
Virtual void chance await not void.
Sorry.
Protected float.
Chance to spawn.
Now we need to do protected virtual void start.
We kind are going to do a boolean here.
Bool can spawn and here we're going to check chance to spawn.
If chance does spawn bigger or equals than random range between zero and 100, how is going to work?
Let's say by default our chance to spawn 60.
This is our default value.
Now we do this, we see random number was let's say for example, random number was 59.
We're going to check if a chance to spawn is higher than 59.
Yes, it is.
It means it can spawn, right?
Because this is going to be true until chance to spawn is bigger than random value.
Then we do this if no cancer found.
Then destroy the game object.
And now we need to go to our moving trap.
I will comment out this line and override.
Start.
Override.
Start.
So we have this code in the moving trap.
Then I'm going to take this.
And paste it in here because we assigned position, if you remember.
Let's save it all.
Go back to Unity.
Yeah.
Now you can.
Yeah, well, it was set by default, and now we can play some traps and see, sometimes it's going
to be there.
Sometimes it's not.
And just for experiment, let's place a bunch of them.
Uh, five.
Let's see how many respond to.
Going to die.
For.
One.
Four.
So you get the point, right.
Let's go back to the old part.
Let's go back to the whole part.
Now we are kind of ready.
And here is what you want to do to make your level parts.
You set platform to 4x4.
Again, it's not necessary.
It's just easier to manage the size of the level part of the entire level section with this one.
Now you go back to prefab folder and you duplicate this one control D to duplicate.
Then you go to new created prefab level part one and you change it how you like.
I will try to recreate level parts I had in my first version of the course because I really like those.
They were cool.
I remember I did a lot of testing to make them.
Once you're done with your level part and go back to level generator.
And move it here to a level parts section.
When you want to create a new one, you duplicate the whole part zero.
You go inside, you change it.
To something nice.
You go back to the old generator, you drag it here and you go test the game, see how it feels.
And I told you before that this is a rework of the course after like seven or eight months.
But there is a video from previous version of the course where I share some advice on creation of level
parts, and I think that information is still valuable.
So I'm going to put it here and let's watch it together.
All right, guys.
And about advice, as I promised, first, what I want to say is try not to sweat it out to my shock.
Relax.
It's your first game.
You're creating your first levels.
Whatever you do will be great, I'm sure.
Whatever you're going to show to your friends.
Look what I created.
It's going to be cool.
In any case, if you reach this point on my course, I'm very glad.
And I'm sure you're doing great job there.
I wish.
I honestly wish I could meet you, but we're not talking about that, right?
So try not to sweat it out too much.
Take it easy, make a level, run it for a bit, test it out, check out how it feels.
Change something, Try not to make it too hard.
It's much better to have a feeling of a flow.
Let's run rather than hard difficult runner where you need to jump over each drop again and again.
All right.
And pay attention to balance.
You see, if there is not enough traps on the levels, make next level apart with the traps.
If you feel like you're using not enough of slight ability, try to make some level of parts where you
use in slight ability.
If you feel like there is not enough jump in, make some wide spaces between platforms on level parts.
So player going to jump from one to another.
Yeah.
Balance and somehow and again relax, keep it simple.
This is a runner.
It should feel easy to run.
It should feel nice how you run it and collecting the coins.
Remember your self when you play it.
Subway surfers, for example.
Right.
Most of the time you just run into the left and right and collecting coins and sometimes you get in
trouble.
That's how it should feel and also try to create more moments.
What I mean is try to create some places where player would do some cool stuff.
Like, for example, I created this very high platform and when you jump in from this platform, for
me it feels nice.
It feels like jumping Assassin's Creed or something.
When you jump in from the high tower down all the way down, or this place where I slide and then I
do double jump and I do flip and I save myself from the step of this.
This is very nice.
It feels cool.
And also try to create two ways of passing level parts.
For example, like I have here, if I slide, I get some coins.
If I did not slide here.
Still, there is a way to pass this section.
I can run on the top.
Just jump over the drop and pass my level apart and go to the next one.
And there is always a new way to pass this.
I can go up or I can go down some more rewarding and harder to pass.
Some are easier, but there is less coins.
But in general, don't be greedy about coins.
Place them everywhere, drop them as much as you like.
It feels nice to collect coins when you play some game.
And since we talked about traps and coins, remember when you drag trap to the level part you can select
it and change chance to pound for each trap individually.
So if you feel like some level parts to hard with the traps, make chance to spawn less.
So it will happen only sometimes that player will die here, but most of the time there will be no trap
at all.
Or if you feel like little part is easy to pass, place a few more traps there, but try to balance
it and again, try not to make game very hard.
It should be easy game, it should be casual game.
Your mom should be able to play this game.
Your kid, your friends from school.
Everyone should be able to play in this game and remember what is a fair challenge for developer.
For player, it's usually difficult.
Again, what is a fair challenge for developer usually is difficult for player.
So if you feel like it's easy for you, it doesn't mean it will be easy for your friend.
Well, enjoy, create and when you're done, let's go to next section.
We're going to make UI next time like a menu, bows and all this stuff.