WEBVTT

00:00.020 --> 00:00.470
Hello guys.

00:00.470 --> 00:01.670
Welcome to a new section.

00:01.670 --> 00:06.500
In this section we're going to develop lots of new mechanics lots of cool things.

00:06.500 --> 00:10.160
Just want to show you how to work with the, you know triggers timers.

00:10.160 --> 00:12.260
They're going to be so many different stuff we're going to do.

00:12.260 --> 00:17.090
And I really believe this will help you to learn a lot about the development.

00:17.090 --> 00:18.680
So I'm going to start with simple.

00:18.680 --> 00:20.780
I want to make a very simple trap.

00:20.780 --> 00:23.000
Let's go to graphics traps.

00:23.000 --> 00:25.580
And over here we have this spikes folder.

00:25.580 --> 00:28.460
It is a very simple trap but still we can use it.

00:28.460 --> 00:32.330
So I'm going to just take the sprite sheet.

00:32.330 --> 00:34.850
Let's make pixel per unit 16.

00:35.730 --> 00:39.600
And then let's take the image and drag it into the scene, just like so.

00:43.070 --> 00:45.290
I want to rename it to.

00:46.060 --> 00:52.960
Trap spike, and I think it should be in front of a background but behind the ground itself, so we

00:52.960 --> 00:54.640
can nicely place it.

00:54.640 --> 01:00.700
Because of that, I'm going to go to Sprite Renderer, choose Search and Layer Traps, and I want to

01:00.700 --> 01:04.090
click over here and adjust order over here.

01:04.090 --> 01:06.490
I'm going to place traps above the ground.

01:06.610 --> 01:12.640
So now traps will always be behind the ground and we can place it like this maybe.

01:12.640 --> 01:14.200
Yeah this is just good.

01:15.310 --> 01:17.530
Now let's give it a circle Collider.

01:17.530 --> 01:21.160
Maybe we only need to move the collider down.

01:21.160 --> 01:23.800
We can do it by using offset over here.

01:24.190 --> 01:29.200
Just going to do -0.40 .50.3.

01:29.860 --> 01:30.850
Let's do 0.4.

01:30.850 --> 01:31.390
It's okay.

01:31.390 --> 01:32.590
This looks fine to me.

01:33.840 --> 01:35.550
Maybe a bit to the left.

01:36.220 --> 01:36.550
Hmm.

01:40.180 --> 01:42.010
Yeah, something like this will do.

01:42.010 --> 01:46.270
I like it, and we need to set it to a trigger.

01:46.270 --> 01:49.300
And after that we need to add damage.

01:49.300 --> 01:50.800
Trigger script.

01:51.190 --> 01:52.030
Very cool.

01:52.030 --> 01:54.610
Now let's go to play mode and see if it's working.

01:55.420 --> 01:56.920
I'm pretty sure it does.

01:58.200 --> 01:58.860
Okay.

01:58.860 --> 01:59.520
Very cool.

01:59.520 --> 02:00.720
So we have a knockback.

02:01.770 --> 02:03.510
Now I want to do something here.

02:03.510 --> 02:06.240
I want to change the behavior of a knockback.

02:08.380 --> 02:14.590
As of now we have knocked back set 2.7 and if it has longer value, then we're going to exit the knockback

02:14.590 --> 02:15.220
animation.

02:15.220 --> 02:16.330
Not very nice.

02:16.330 --> 02:19.090
I want to make it as flexible as possible.

02:19.360 --> 02:22.420
That's why we're going to go to animator of a player.

02:23.530 --> 02:27.640
And in the numerator we're going to change this knockback trigger to a boolean.

02:27.640 --> 02:29.020
Let's delete it.

02:29.650 --> 02:33.700
And let's add boolean is knocked.

02:33.700 --> 02:34.630
Okay.

02:34.660 --> 02:40.060
Then over here, instead of doing the condition with the trigger, we're going to choose is knocked

02:40.390 --> 02:42.040
and exit from this animation.

02:42.040 --> 02:43.810
Going to be is knocked.

02:44.770 --> 02:45.400
False.

02:45.400 --> 02:46.540
Just like that.

02:46.780 --> 02:49.690
Also, let's make sure we have a loop on the animation.

02:49.690 --> 02:51.340
So I'm going to select this.

02:51.340 --> 02:55.660
Find the motion, select it and check if we have loop time.

02:55.660 --> 02:57.430
We have it so it's fine.

02:57.880 --> 03:00.040
Now let's go to the script of a player.

03:01.960 --> 03:03.100
We need to find knockback.

03:03.100 --> 03:03.730
Coroutine.

03:03.730 --> 03:04.960
It is over here.

03:05.260 --> 03:07.870
We can remove this set trigger.

03:08.290 --> 03:10.270
And over here I'm going to do enum.

03:10.270 --> 03:11.590
Set bool.

03:12.460 --> 03:14.950
Is knocked to true.

03:14.950 --> 03:18.430
And then after this I can do enum set bool.

03:19.240 --> 03:21.820
Is knocked to false.

03:22.470 --> 03:23.460
Very good.

03:23.520 --> 03:27.930
Actually, we could just, you know, use the is not boolean itself over here.

03:27.930 --> 03:30.630
We could do like so but it doesn't make any difference.

03:30.630 --> 03:34.080
So I'm going to keep it uh, with what I can read better.

03:34.260 --> 03:34.920
All right.

03:34.920 --> 03:36.090
Let's go ahead now.

03:36.090 --> 03:41.280
And let's set knockback duration to some big value like three seconds.

03:41.280 --> 03:43.380
I just want to make sure it is working.

03:45.680 --> 03:48.140
Gonna go and hit the trap and boom!

03:49.050 --> 03:51.030
Okay, I like it.

03:54.170 --> 03:57.920
I think we need to do something here on the animator.

03:57.920 --> 04:01.010
Let's go and uncheck exit time.

04:01.010 --> 04:02.420
As exit time uncheck.

04:02.450 --> 04:03.500
This is better.

04:03.500 --> 04:08.270
Now I'm going to bring back duration of a knockback to something like 0.75.

04:08.270 --> 04:09.920
And I'm going to keep it for now.

04:10.490 --> 04:13.550
Um there is something else I want to improve real quick.

04:13.550 --> 04:17.540
I want to take all of the animations of the player and make simple rate 20.

04:17.540 --> 04:21.620
So I'm going to just go over here and do Simple Rate 20.

04:23.060 --> 04:23.810
Sample rate.

04:23.840 --> 04:24.620
20.

04:25.300 --> 04:27.250
I think it will look better anyway.

04:28.150 --> 04:28.840
The knock.

04:29.430 --> 04:30.150
20.

04:32.180 --> 04:36.710
Move, respond and we'll slide 20.

04:36.740 --> 04:37.520
Okay.

04:37.940 --> 04:39.830
Let's go to the game window.

04:47.210 --> 04:48.200
Looks nice.

04:51.790 --> 04:52.810
Okay.

04:52.810 --> 04:54.610
Maybe I'll make it a bit lower.

04:55.090 --> 04:56.410
Point six.

04:58.860 --> 04:59.490
Good.

04:59.490 --> 05:01.470
Let's go to the next video now.

05:01.470 --> 05:02.280
I'll see you there.
