1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:03,000
In this video, we're going to make character jump.

3
00:00:03,000 --> 00:00:06,000
And again, if you have some experience, you know how to do it.

4
00:00:06,000 --> 00:00:07,000
If you don't, it's fine.

5
00:00:07,000 --> 00:00:08,000
Don't worry.

6
00:00:08,000 --> 00:00:09,000
We're going to teach you.

7
00:00:09,000 --> 00:00:10,000
Let's go to player.

8
00:00:11,000 --> 00:00:12,000
And I want to do something here.

9
00:00:12,000 --> 00:00:13,000
I want to do debug.

10
00:00:13,000 --> 00:00:18,000
DEBUG allows me to see messages in the console window in the unity.

11
00:00:18,000 --> 00:00:18,000
Right.

12
00:00:18,000 --> 00:00:19,000
I'll make it bigger just like that.

13
00:00:19,000 --> 00:00:24,000
What I'll do here is I'll type if and follow me here input.

14
00:00:26,000 --> 00:00:27,000
Get key.

15
00:00:28,000 --> 00:00:29,000
Down.

16
00:00:29,000 --> 00:00:37,000
Then in the parentheses we type key code and use space and to make curly brackets like that real quick,

17
00:00:37,000 --> 00:00:41,000
what you need to do is hold, shift and click enter boom.

18
00:00:42,000 --> 00:00:45,000
Then we do debug that log and we can debug some message over here.

19
00:00:45,000 --> 00:00:47,000
So in quotation marks, I'll type.

20
00:00:48,000 --> 00:00:54,000
My speed is then after quotation marks plus more speed.

21
00:00:54,000 --> 00:00:55,000
All right.

22
00:00:55,000 --> 00:00:56,000
Let's go back.

23
00:00:57,000 --> 00:01:03,000
I have my console over here, but if you don't have it, we need to go to window General.

24
00:01:04,000 --> 00:01:05,000
Console.

25
00:01:05,000 --> 00:01:10,000
And it's there, then you can just arrange it and drag it over here.

26
00:01:10,000 --> 00:01:12,000
Now I'll go to my play mode.

27
00:01:13,000 --> 00:01:15,000
And nothing happening.

28
00:01:15,000 --> 00:01:18,000
I'll change more speed back to zero so he'll stop.

29
00:01:18,000 --> 00:01:21,000
But look, if I select game, we know and I click play.

30
00:01:23,000 --> 00:01:24,000
We can see the message.

31
00:01:26,000 --> 00:01:28,000
This message could be different.

32
00:01:28,000 --> 00:01:32,000
This message could say, I am jumping.

33
00:01:40,000 --> 00:01:47,000
Now if I press it says I'm jumping, or we could make it jump instead.

34
00:01:47,000 --> 00:01:48,000
How do we do that?

35
00:01:48,000 --> 00:01:49,000
Simple.

36
00:01:49,000 --> 00:01:56,000
We type our build velocity equals to new vector to it's going to be same x, rb, velocity, dot x,

37
00:01:56,000 --> 00:01:58,000
and for the Y we're going to pass.

38
00:01:58,000 --> 00:01:59,000
Guess what?

39
00:01:59,000 --> 00:02:01,000
Write jump force.

40
00:02:02,000 --> 00:02:03,000
Just like that.

41
00:02:03,000 --> 00:02:08,000
Now, let's see if it works, and then I'll explain what we did here in the play mode.

42
00:02:11,000 --> 00:02:14,000
Is his jumping, but not high enough.

43
00:02:14,000 --> 00:02:19,000
Let's change more speed to one so he moves slower.

44
00:02:19,000 --> 00:02:22,000
We need to see what he does and then jump.

45
00:02:22,000 --> 00:02:23,000
Force will be eight.

46
00:02:23,000 --> 00:02:25,000
Let's go and do that.

47
00:02:26,000 --> 00:02:27,000
Yeah.

48
00:02:28,000 --> 00:02:29,000
Yeah, boy.

49
00:02:29,000 --> 00:02:30,000
Jump in.

50
00:02:30,000 --> 00:02:31,000
Woo hoo!

51
00:02:32,000 --> 00:02:34,000
So what we did now is we used input.

52
00:02:34,000 --> 00:02:35,000
How we did that.

53
00:02:35,000 --> 00:02:38,000
First we called input and then we used get key.

54
00:02:38,000 --> 00:02:43,000
There are different ways to do that, and I'll spend a couple of minutes in the next video talking about

55
00:02:43,000 --> 00:02:44,000
input.

56
00:02:44,000 --> 00:02:45,000
So now let's just talk about this.

57
00:02:45,000 --> 00:02:52,000
If statement in general, if statement is basically very simple and I guess if you never coded before,

58
00:02:52,000 --> 00:02:57,000
you still heard about this, like if something happens, then do this.

59
00:02:57,000 --> 00:03:03,000
If input code key space, then write a message.

60
00:03:03,000 --> 00:03:06,000
If input key code space, then jump.

61
00:03:06,000 --> 00:03:08,000
If let's say let's make another one.

62
00:03:08,000 --> 00:03:18,000
If move speed equals equals to zero, then debug log message should be in the quotation marks.

63
00:03:18,000 --> 00:03:19,000
Ahoy.

64
00:03:20,000 --> 00:03:26,000
If this then that right And this, How are we going to do like most of the stuff here?

65
00:03:26,000 --> 00:03:26,000
Look.

66
00:03:28,000 --> 00:03:29,000
More speed is one.

67
00:03:29,000 --> 00:03:36,000
So this if statement is false and this doesn't work, but if I change more speed back to zero, we can

68
00:03:36,000 --> 00:03:41,000
see move speed is equal to zero now and message is printed all the time.

69
00:03:41,000 --> 00:03:41,000
Ahoy!

70
00:03:42,000 --> 00:03:43,000
Something like that.

71
00:03:43,000 --> 00:03:46,000
All right, Let's delete this and let's go to next video.

