WEBVTT

00:00.050 --> 00:00.530
Hello guys.

00:00.530 --> 00:01.430
Welcome to the video.

00:01.430 --> 00:05.690
In this one we're going to make a finish point and we're going to upgrade the start point.

00:05.690 --> 00:06.890
We have nothing much.

00:06.890 --> 00:09.350
Just you know set up animations and make it pretty.

00:09.350 --> 00:14.420
Let's go to asset graphics item checkpoints.

00:14.420 --> 00:15.530
Let's go to end.

00:15.530 --> 00:16.940
Let's select this tool.

00:17.210 --> 00:19.850
Let's make pixel per unit 16 apply.

00:19.880 --> 00:23.540
Then on the start this is 16 okay.

00:23.870 --> 00:24.740
Let's go to end.

00:24.740 --> 00:28.520
And let's take this idle one and drag it to the scene.

00:29.210 --> 00:30.350
On Assetid.

00:31.040 --> 00:32.690
As an item.

00:34.880 --> 00:35.990
Just like that.

00:35.990 --> 00:37.550
Okay, this is good.

00:37.910 --> 00:41.390
And let's do it as end point.

00:43.670 --> 00:46.610
So endpoint would do a very simple functionality.

00:46.610 --> 00:49.820
It would just make sure you finish the game.

00:49.820 --> 00:53.810
You need to make an enter trigger and call some method game over.

00:53.810 --> 00:54.800
All level finished.

00:54.800 --> 00:58.580
We don't have any level management yet, so we're just going to debug a message.

00:58.580 --> 01:03.260
But later on, once we know how it's working all together, we're going to just replace debug message

01:03.260 --> 01:04.040
with a method.

01:05.140 --> 01:05.620
Yeah.

01:05.620 --> 01:09.340
So let's go to animation controllers and a checkpoint.

01:09.340 --> 01:15.700
We can make animator controller for finish point.

01:16.450 --> 01:18.490
Let me do camel case here.

01:19.240 --> 01:21.700
And we're gonna select endpoint.

01:21.700 --> 01:22.360
Drag it here.

01:22.360 --> 01:24.400
Actually let's do it as a finish point.

01:26.190 --> 01:26.640
Yeah.

01:26.640 --> 01:29.160
So now we have animator on a finish point.

01:29.160 --> 01:33.990
We can go to animations, create new one and checkpoints.

01:33.990 --> 01:40.290
Let's do finish finish point idle on the graphics.

01:40.290 --> 01:45.360
We're going to find item checkpoint and lays the idle.

01:45.360 --> 01:50.130
Then new clip finish point activated.

01:52.140 --> 01:55.410
And over here we're going to take these sprites and drag them here.

01:55.410 --> 01:57.750
Let's do sample rate 20.

01:57.810 --> 02:03.210
Then on the animator of a finish point let's make a trigger.

02:04.850 --> 02:06.830
Activate.

02:07.730 --> 02:10.130
And we're going to transfer it to this animation.

02:12.880 --> 02:19.480
Uh, with a trigger as exit time and check transition duration zero.

02:19.480 --> 02:24.430
Also now when we enter the point animation going to replay itself.

02:26.970 --> 02:32.850
So maybe it is better to switch off the loop for animation, but I'm not yet sure how animation looks,

02:32.850 --> 02:36.810
I don't remember, so we're going to say animation first, and we're going to decide if we need to switch

02:36.840 --> 02:38.370
off the loop for animation.

02:38.910 --> 02:47.220
Let's go to scripts and let's make the script finish point would be better as a finish line I think.

02:47.670 --> 02:49.230
Then on a finish point.

02:50.590 --> 02:53.170
Let's just do simple on trigger enter.

02:53.530 --> 02:56.650
Uh, we could use inheritance for this one, by the way.

02:57.300 --> 03:01.260
We just need this method from any item.

03:01.260 --> 03:02.940
I'm going to copy this method.

03:03.300 --> 03:05.160
Go to finish point.

03:06.040 --> 03:09.130
Pasted in, then this is going to be removed.

03:10.910 --> 03:12.890
Let's make an animator.

03:14.580 --> 03:16.650
Animator anim.

03:17.840 --> 03:19.730
And get component of animator.

03:19.730 --> 03:20.360
Very cool.

03:20.360 --> 03:21.710
Similar to the last one.

03:21.710 --> 03:25.190
And then over here we're going to do anim set trigger.

03:27.020 --> 03:27.830
Activate.

03:28.940 --> 03:30.680
And we can do debug log.

03:33.960 --> 03:37.140
You completed the level.

03:41.190 --> 03:42.390
Simple as that.

03:42.780 --> 03:45.780
And let's go ahead and make sure it is working.

03:52.120 --> 03:53.530
Just gonna.

03:59.130 --> 04:00.120
Run there.

04:00.780 --> 04:01.410
And.

04:03.410 --> 04:04.310
He didn't work.

04:04.940 --> 04:07.310
Because we don't have a box collider.

04:07.310 --> 04:08.570
We need a box Collider.

04:08.570 --> 04:09.800
Box Collider 2D.

04:11.110 --> 04:12.070
Is trigger.

04:12.880 --> 04:14.110
And I think it can be big.

04:16.830 --> 04:17.100
Yeah.

04:17.520 --> 04:19.440
Oh, I'm sometimes.

04:19.440 --> 04:21.030
Oh, my God, I'm so sorry.

04:21.450 --> 04:23.130
We need to put the script on.

04:24.300 --> 04:25.500
Okay again.

04:25.500 --> 04:26.370
Yeah.

04:26.370 --> 04:30.090
So it's working, but we need to switch off the loop for the animation.

04:30.090 --> 04:31.920
Let's exit play mode.

04:32.340 --> 04:41.160
Let's put the finish point and let's put box Collider 2D is trigger okay.

04:41.890 --> 04:49.270
And then we need to go to assets animations checkpoint find uh, finish point.

04:49.990 --> 04:50.740
Activated.

04:50.740 --> 04:52.060
So this is the one.

04:53.040 --> 04:54.540
Finish point activated.

04:54.540 --> 04:57.330
And over here we need to uncheck loop time.

04:57.720 --> 04:59.490
Okay I'm going to try again.

05:00.060 --> 05:01.740
Let me just move my player.

05:06.040 --> 05:07.510
And nice.

05:07.510 --> 05:09.130
You completed the level.

05:09.900 --> 05:11.790
Very good, I like it.

05:14.780 --> 05:19.370
There is no much things to do with the endpoint right now, because we don't have any completion of

05:19.370 --> 05:19.760
the level.

05:19.760 --> 05:24.080
I just want to, you know, since we are working with the checkpoints, I wanted to do it all together.

05:24.320 --> 05:27.740
And now let's improve the start point and we're good to go.

05:28.770 --> 05:31.860
We need another animator controller for this one.

05:33.540 --> 05:35.070
Start point a.

05:35.100 --> 05:35.460
C.

05:35.820 --> 05:37.830
Let's select the start point.

05:37.830 --> 05:38.940
Drag it here.

05:38.940 --> 05:40.860
Then we need to go to scripts.

05:40.860 --> 05:43.320
And I think it's a yeah.

05:43.320 --> 05:45.900
It's time to make a folder in a script folder.

05:45.900 --> 05:46.590
Let's do.

05:47.410 --> 05:49.030
Checkpoint folder.

05:49.030 --> 05:51.310
You're going to take checkpoint finish point.

05:51.310 --> 05:52.690
Drag it inside.

05:53.690 --> 05:55.550
And it's okay.

05:55.550 --> 05:56.300
Don't worry.

05:58.090 --> 06:00.700
And inside we're going to make new C sharp script.

06:01.610 --> 06:02.930
Start point.

06:02.930 --> 06:08.810
We could do different things here, maybe start the timer or any other things that need to be done in

06:08.810 --> 06:10.190
the beginning of the game.

06:10.400 --> 06:18.770
As of now, we'll just do something else here instead of using on trigger enter, I want to use on trigger

06:18.770 --> 06:25.340
exit because there is this arrow animation of a start point that swings when you pass in by.

06:26.290 --> 06:29.740
So I'm going to do on trigger exit to D.

06:30.720 --> 06:33.960
And over here we're going to need player.

06:34.770 --> 06:35.820
Player.

06:36.710 --> 06:39.620
So collision get component of a player.

06:39.620 --> 06:44.030
If player not equals to null, then we're going to trigger the animation.

06:44.270 --> 06:49.010
So I'm going to do public sorry private animator anim.

06:49.980 --> 06:52.200
And get component of animator.

06:52.200 --> 06:55.470
And then here anim set trigger.

06:56.310 --> 06:57.240
Activate.

06:57.480 --> 06:58.800
Simple as that.

06:59.160 --> 07:04.950
Uh, you probably noticed that we're doing on trigger Exit instead of instead of on trigger enter,

07:05.130 --> 07:07.080
and it works in a very similar way.

07:07.080 --> 07:09.660
But when player exiting the trigger.

07:09.660 --> 07:11.400
Let's go to the start point.

07:12.350 --> 07:17.480
Let's add a box Collider 2D, and this time we're going to just make it slim.

07:18.760 --> 07:20.950
Something like this will work.

07:22.860 --> 07:24.420
Yeah, I know it's very slim.

07:24.600 --> 07:26.640
Then we're going to put start Point over here.

07:26.640 --> 07:28.680
Let's make this trigger.

07:28.890 --> 07:31.110
Then let's make animations.

07:31.110 --> 07:34.050
We need to create animation clip assets.

07:34.050 --> 07:36.120
Animation checkpoint.

07:36.120 --> 07:38.160
Start point.

07:38.160 --> 07:39.000
Idle.

07:41.660 --> 07:43.250
Let's go to graphics.

07:44.480 --> 07:45.350
Items.

07:45.350 --> 07:47.960
Checkpoints start idle.

07:47.960 --> 07:53.330
Then we need new clip start, point activated.

07:54.550 --> 07:56.740
And we're going to just take these sprites.

07:57.810 --> 07:59.280
And put them all here.

07:59.280 --> 08:00.690
Sample rate 20.

08:00.690 --> 08:02.730
And this is what happens when you pass in by.

08:04.070 --> 08:06.140
It sort of shaken like that.

08:07.130 --> 08:08.990
That's why I want to have Slim Collider.

08:08.990 --> 08:11.690
That's why I want to have on Trigger Exit, not enter.

08:14.610 --> 08:15.270
Okay.

08:15.930 --> 08:17.310
Let's go to animator.

08:17.640 --> 08:18.540
Our start point.

08:18.540 --> 08:20.940
And here we're going to have an idle.

08:21.720 --> 08:26.100
And this animation will be entered from any state, I think.

08:26.100 --> 08:26.580
Yeah.

08:26.580 --> 08:30.990
Let's do make transition from any state with a parameter.

08:32.130 --> 08:33.090
Activate.

08:34.620 --> 08:36.900
So activate.

08:37.910 --> 08:41.750
Can transit to self and check transition duration zero.

08:42.330 --> 08:48.900
Then from here make transition to idle with an exit time one, transition duration zero because we want

08:48.900 --> 08:54.720
to activate it from an idle or I think actually we don't need to do from any state we can do from the

08:54.720 --> 08:55.680
idle itself.

08:58.340 --> 08:59.090
With a condition.

08:59.090 --> 09:01.250
Activate duration zero.

09:01.250 --> 09:02.330
Exit time one.

09:02.600 --> 09:03.350
Very cool.

09:03.350 --> 09:05.210
That's all what we need to do here.

09:06.650 --> 09:07.790
Let's go back.

09:08.000 --> 09:12.290
Let's take the player and place him somewhere here.

09:14.950 --> 09:18.070
And this is how it looks when you exit in the trigger.

09:23.010 --> 09:23.700
Yeah.

09:25.110 --> 09:27.720
Probably would be better to respawn player.

09:29.920 --> 09:32.830
On the arrow because otherwise it will not be triggered.

09:34.180 --> 09:35.170
As you can see.

09:36.060 --> 09:37.650
So let's adjust.

09:37.950 --> 09:43.560
Let's go to start point and make empty object respawn point.

09:43.950 --> 09:45.870
We're going to give it gizmo so we can see it.

09:45.900 --> 09:47.370
We can do it over here.

09:48.400 --> 09:50.830
Uh, something like this.

09:52.440 --> 09:56.670
Then we're going to move this to the place of the arrow over here.

09:57.060 --> 10:03.420
And on a game manager, we're going to choose this respawn point as a first respawn point.

10:03.660 --> 10:04.350
Okay.

10:04.350 --> 10:05.340
The child one.

10:06.460 --> 10:07.120
This one.

10:08.990 --> 10:09.710
Cool.

10:09.980 --> 10:11.780
Now let's go and try again.

10:11.780 --> 10:13.250
It's supposed to work.

10:18.670 --> 10:21.730
Yeah, somewhat of what we need.

10:21.760 --> 10:22.510
I like it.

10:22.510 --> 10:24.250
Well, that's good for this video.

10:24.250 --> 10:28.930
I don't think we need to do anything else at the moment, so I'll see you in the next one.

10:28.930 --> 10:29.440
Bye.
