Welcome back, my fellow game developers
to a brand new video.
And in this one we are going to do a couple of things.
First of all, we've added a cinema machine combiner.
What is that?
That means that our camera no longer goes out of bounds.
It's movement is a bit weird,
but because we didn't give it enough time, remember,
we could see the blue lines and
here we no longer see them.
And now when we move through the portal, Whoa,
you can see that we move in
slow motion and then we go to the next level.
So there is a bit of
delay and the time scale of our world.
So let's not waste any more time.
And let's get started.
Oh, okay, So now it's time to make
our transitions just a little bit more cool.
And first thing I want to do is I want to
go into the console and see this message right here.
And I'm just going to delete this.
We don't need it anymore.
This was just for debugging purposes.
And whenever you have some kind of error or
you're not sure of something,
use debug dot log at helps out
a lot just to see if some condition is working.
Some condition is not whether
the amount of enemies it
has finished and so on and so forth.
So debug dot log is best, amazing.
It saved my behind so many times.
So let's continue one,
what do we want to do in here?
Well, first thing we want to
do is once we go through the portal.
So when we go to the portal,
we don't want to have our player just running around
like a crazy maniac after he enters there,
we want to actually stop him and
make him just wait a couple of seconds.
Weight.
So there's a difference.
Do we want to completely stop the player?
Or we can do something even better?
And we can actually slow down the time in which moves,
so his movement will become much slow.
How about that?
I think it's a better solution.
So I'm going to open up the level manager.
And in here after we start loading the next level,
what I'm going to do is I'm going to
access the time and I'm going
to access the time scale on the world.
And you can see right here what is the timescale?
It's the scale at which time passes.
So currently the time passes normally in our game,
what I'll do is I'll change this to 0.2.
So now it will be running at the
20% of its original speed.
And let's see how that looks.
I don't recommend that you do this all the time
because not only does the game slow down,
but everything slows down,
so even the animation.
So I'm going to run,
I'm going to enter the portal and you'll notice that now,
whoa, how cool is that?
The gun is still pointing correctly, obviously,
but the animation is much slower.
So there you go, Michael Jackson.
And we are at level two.
Very nice, but we are still moving.
Oh, and look at the bullets.
But the bullets, how cool is this bullets?
I recommend that you remember this and
you added a some kind of mechanic into your game.
So everything slows down and let me
just shoot a couple of
bullets and get the hell away from there.
How cool is that? Seriously?
Not tell me that's not really cool.
So now what we want to do is we want to go back.
So as you saw from level 2,
we are moving in slow motion,
but when we go to level 1,
we are back at this really bad timing.
So what we do is we are going to issue this challenge.
We set the scale back.
So obviously we don't want
to have the timescale like this.
So find where we need to set
the time-scale back to its original form.
And I will give you a hint of what or how to
set it back to its original form to return to normal,
set the time-scale back to 1.
A-flat means it's 100% not 0.1,
or you can make it even faster.
Does that out enjoy, have fun.
Make sure to turn back the scale to its original form.
Where should we do that?
Pause the video right now and go do the challenge.
Okay, welcome back.
I hope you figure that out.
Where should we do that?
Well, we start the timescale.
We wait for two seconds,
and then after we finish,
before we load, the next scene,
will access the time dot timescale
and sell it back to one f. Say that back in our game.
From the game, go up, go through portal,
and do not something that now it takes
more than two seconds to load level. So one.
Two, Why is that?
Well, because timescale is slowed down.
There we go.
So now we are back here and everything is working fine.
So the final thing that we need to
fix is the fact that we have to
wait so long for the level to load. Why is that?
Well, obviously because here we are
waiting for seconds, the time to load,
but before we do that,
the timescale has been set to be 0.2,
so 20 percent of the original time.
How are we going to fix this?
Well, fortunately, there is
something really nice and here,
really convenient that says that we have to
wait for seconds in real time.
So this spends the court in execution to
a given amount of second using unskilled time.
Can you read this? Is I think we should make it bigger.
No, unskilled time.
So wait for where is it?
Wait four seconds in real time, we save that.
And now the co-routine is no
longer affected by the timescale.
So now let's just test this out.
Run, run, run, run, get to this
112 and we are in the level one.
Really nice.
I hope you enjoy it.
I hope you're having fun.
And let's see, we have still a couple of minutes.
It's a very short video.
There is something that I wanted to address.
So in here when we run the game,
actually let's make this a bit bigger so we can see.
So now we walk around,
OK, so everything is black.
We feel that we are in the game properly,
but we see this blue right here,
and I don't like it.
Now, we could cover this with a couple of black boils.
That would be a good solution,
not a bad one, of course,
but there is a much better way and a property
inside of Cinema machine that
we are going to take advantage of,
and that is the confinement.
So I'm going to make the scene a bit bigger.
I'm going to zoom out.
And if I click on the virtual camera right here,
you can see down here that we have
something that says, where is it?
Okay, so there we go,
Add Extension Center machine confined,
and it creates an additional component in here.
And you can see that we have the bounding shape and
the bounding shape is required and it
should be a polygon collider.
What is a polygon?
Polygon means that just like we have a circle, rectangle,
triangle, polygon means that
we can give whatever shape we want.
So what does this do?
It adds a bound to the way
the camera or how much the camera can move.
Let me explain.
I'm going to go in the where is it the grid naming?
Right-click in here. I'm going to add maybe a component.
And let's go ahead and call it the true
because of the polygon collider 2D.
There we go. I can edit this.
You can see this is the polygon,
so we can, there we go.
Make it like this.
If you hold down Control,
you can see this red line.
This means that it will be deleted.
So I'm going to go ahead and make the bounds for
which our camera or the machine camera is moving in,
the bounds which it does not go through.
So I'm going to make sure that,
for example, we cannot
look right here and look what we can do.
Actually, we can add another point.
This is why we need a polygon collider, and there we go.
So the camera will not be
able to go outside these bonds and
we will not be able to see the blue in here. Can we?
Does Michael tell the truth?
Not always.
That's run it again and see for ourselves.
So, Okay, I am outside the bond because
there's something very important
and it needs to be a trigger.
We don't want it to affect anything.
And even better if we can make
this grid a different player.
So I think we will have to make it a different layer,
yet we will have to make it a different layer.
So that's why I wanted to call the grid the untouchable,
call it the wrong layer.
And the North this object only
because it will affect
only the polygon we have the walls,
we may want the walls to interact with the player.
So run the game,
okay, with the bullets of the players.
There we go.
Now we are not interacting.
And if we go up here,
we used to see the blue lines.
Remember, we are still seeing
the blue lines because he
made one of the biggest mistakes.
We didn't even assign the polygon collider right here.
So drag the grid, and there you go.
Now we have the polygon collider, run the game.
We can show it around and then we go.
So Didn't I tell you?
Okay.
So as you can see,
I can no longer oh,
and look in the scene mode.
You can see that now the camera
moves only with how much the confinement allows it to.
So as soon as we hit one of the others, There you go,
the camera does not work anymore and you can see it
is forced to move up through there.
Very nice. So this is
a very nifty trick that you've learned.
You can go down, as you can see,
we can no longer move the camera.
Look where we are.
We are no longer in the center because
the camera is confined right here.
It does not move.
So I hope you enjoy it.
I hope you like the strict.
Obviously this needs to be fixed.
I don't like it at all.
We need to change this polygon collider a little bit.
So maybe make it like that,
Maybe this one like that.
So it's always better to have the shapes squared up.
Make sure that you look through this.
Don't just do with nonchalantly,
make sure that you take time to
create the combiner properly.
So that done, I hope you
enjoyed the video is enough length.
There is still one thing that we need to fix and
that is the blood animation on the enemies.
So I'm going to give you that task.
So here this flash animations at the end,
we want to make sure to destroy all of
these blood that come off the player, the enemy.
We don't want to keep them in the hierarchy.
So with that done, I hope you enjoy it.
I hope you are staging everything, stage all.
What did we do in this video changed
the time scale and now
it's much cooler when transitioning.
And made a cinema machine. Gunfire.
Commit the changes.
Look at the master.
Appreciate your work.
Enjoy how far you've come,
and I'll see you in the next video.