Hello guys.
Welcome to the video.
In this one we're going to make a finish point and we're going to upgrade the start point.
We have nothing much.
Just you know set up animations and make it pretty.
Let's go to asset graphics item checkpoints.
Let's go to end.
Let's select this tool.
Let's make pixel per unit 16 apply.
Then on the start this is 16 okay.
Let's go to end.
And let's take this idle one and drag it to the scene.
On Assetid.
As an item.
Just like that.
Okay, this is good.
And let's do it as end point.
So endpoint would do a very simple functionality.
It would just make sure you finish the game.
You need to make an enter trigger and call some method game over.
All level finished.
We don't have any level management yet, so we're just going to debug a message.
But later on, once we know how it's working all together, we're going to just replace debug message
with a method.
Yeah.
So let's go to animation controllers and a checkpoint.
We can make animator controller for finish point.
Let me do camel case here.
And we're gonna select endpoint.
Drag it here.
Actually let's do it as a finish point.
Yeah.
So now we have animator on a finish point.
We can go to animations, create new one and checkpoints.
Let's do finish finish point idle on the graphics.
We're going to find item checkpoint and lays the idle.
Then new clip finish point activated.
And over here we're going to take these sprites and drag them here.
Let's do sample rate 20.
Then on the animator of a finish point let's make a trigger.
Activate.
And we're going to transfer it to this animation.
Uh, with a trigger as exit time and check transition duration zero.
Also now when we enter the point animation going to replay itself.
So maybe it is better to switch off the loop for animation, but I'm not yet sure how animation looks,
I don't remember, so we're going to say animation first, and we're going to decide if we need to switch
off the loop for animation.
Let's go to scripts and let's make the script finish point would be better as a finish line I think.
Then on a finish point.
Let's just do simple on trigger enter.
Uh, we could use inheritance for this one, by the way.
We just need this method from any item.
I'm going to copy this method.
Go to finish point.
Pasted in, then this is going to be removed.
Let's make an animator.
Animator anim.
And get component of animator.
Very cool.
Similar to the last one.
And then over here we're going to do anim set trigger.
Activate.
And we can do debug log.
You completed the level.
Simple as that.
And let's go ahead and make sure it is working.
Just gonna.
Run there.
And.
He didn't work.
Because we don't have a box collider.
We need a box Collider.
Box Collider 2D.
Is trigger.
And I think it can be big.
Yeah.
Oh, I'm sometimes.
Oh, my God, I'm so sorry.
We need to put the script on.
Okay again.
Yeah.
So it's working, but we need to switch off the loop for the animation.
Let's exit play mode.
Let's put the finish point and let's put box Collider 2D is trigger okay.
And then we need to go to assets animations checkpoint find uh, finish point.
Activated.
So this is the one.
Finish point activated.
And over here we need to uncheck loop time.
Okay I'm going to try again.
Let me just move my player.
And nice.
You completed the level.
Very good, I like it.
There is no much things to do with the endpoint right now, because we don't have any completion of
the level.
I just want to, you know, since we are working with the checkpoints, I wanted to do it all together.
And now let's improve the start point and we're good to go.
We need another animator controller for this one.
Start point a.
C.
Let's select the start point.
Drag it here.
Then we need to go to scripts.
And I think it's a yeah.
It's time to make a folder in a script folder.
Let's do.
Checkpoint folder.
You're going to take checkpoint finish point.
Drag it inside.
And it's okay.
Don't worry.
And inside we're going to make new C sharp script.
Start point.
We could do different things here, maybe start the timer or any other things that need to be done in
the beginning of the game.
As of now, we'll just do something else here instead of using on trigger enter, I want to use on trigger
exit because there is this arrow animation of a start point that swings when you pass in by.
So I'm going to do on trigger exit to D.
And over here we're going to need player.
Player.
So collision get component of a player.
If player not equals to null, then we're going to trigger the animation.
So I'm going to do public sorry private animator anim.
And get component of animator.
And then here anim set trigger.
Activate.
Simple as that.
Uh, you probably noticed that we're doing on trigger Exit instead of instead of on trigger enter,
and it works in a very similar way.
But when player exiting the trigger.
Let's go to the start point.
Let's add a box Collider 2D, and this time we're going to just make it slim.
Something like this will work.
Yeah, I know it's very slim.
Then we're going to put start Point over here.
Let's make this trigger.
Then let's make animations.
We need to create animation clip assets.
Animation checkpoint.
Start point.
Idle.
Let's go to graphics.
Items.
Checkpoints start idle.
Then we need new clip start, point activated.
And we're going to just take these sprites.
And put them all here.
Sample rate 20.
And this is what happens when you pass in by.
It sort of shaken like that.
That's why I want to have Slim Collider.
That's why I want to have on Trigger Exit, not enter.
Okay.
Let's go to animator.
Our start point.
And here we're going to have an idle.
And this animation will be entered from any state, I think.
Yeah.
Let's do make transition from any state with a parameter.
Activate.
So activate.
Can transit to self and check transition duration zero.
Then from here make transition to idle with an exit time one, transition duration zero because we want
to activate it from an idle or I think actually we don't need to do from any state we can do from the
idle itself.
With a condition.
Activate duration zero.
Exit time one.
Very cool.
That's all what we need to do here.
Let's go back.
Let's take the player and place him somewhere here.
And this is how it looks when you exit in the trigger.
Yeah.
Probably would be better to respawn player.
On the arrow because otherwise it will not be triggered.
As you can see.
So let's adjust.
Let's go to start point and make empty object respawn point.
We're going to give it gizmo so we can see it.
We can do it over here.
Uh, something like this.
Then we're going to move this to the place of the arrow over here.
And on a game manager, we're going to choose this respawn point as a first respawn point.
Okay.
The child one.
This one.
Cool.
Now let's go and try again.
It's supposed to work.
Yeah, somewhat of what we need.
I like it.
Well, that's good for this video.
I don't think we need to do anything else at the moment, so I'll see you in the next one.
Bye.