Hello, guys.
In this video, we're going to make character jump.
And again, if you have some experience, you know how to do it.
If you don't, it's fine.
Don't worry.
We're going to teach you.
Let's go to player.
And I want to do something here.
I want to do debug.
DEBUG allows me to see messages in the console window in the unity.
Right.
I'll make it bigger just like that.
What I'll do here is I'll type if and follow me here input.
Get key.
Down.
Then in the parentheses we type key code and use space and to make curly brackets like that real quick,
what you need to do is hold, shift and click enter boom.
Then we do debug that log and we can debug some message over here.
So in quotation marks, I'll type.
My speed is then after quotation marks plus more speed.
All right.
Let's go back.
I have my console over here, but if you don't have it, we need to go to window General.
Console.
And it's there, then you can just arrange it and drag it over here.
Now I'll go to my play mode.
And nothing happening.
I'll change more speed back to zero so he'll stop.
But look, if I select game, we know and I click play.
We can see the message.
This message could be different.
This message could say, I am jumping.
Now if I press it says I'm jumping, or we could make it jump instead.
How do we do that?
Simple.
We type our build velocity equals to new vector to it's going to be same x, rb, velocity, dot x,
and for the Y we're going to pass.
Guess what?
Write jump force.
Just like that.
Now, let's see if it works, and then I'll explain what we did here in the play mode.
Is his jumping, but not high enough.
Let's change more speed to one so he moves slower.
We need to see what he does and then jump.
Force will be eight.
Let's go and do that.
Yeah.
Yeah, boy.
Jump in.
Woo hoo!
So what we did now is we used input.
How we did that.
First we called input and then we used get key.
There are different ways to do that, and I'll spend a couple of minutes in the next video talking about
input.
So now let's just talk about this.
If statement in general, if statement is basically very simple and I guess if you never coded before,
you still heard about this, like if something happens, then do this.
If input code key space, then write a message.
If input key code space, then jump.
If let's say let's make another one.
If move speed equals equals to zero, then debug log message should be in the quotation marks.
Ahoy.
If this then that right And this, How are we going to do like most of the stuff here?
Look.
More speed is one.
So this if statement is false and this doesn't work, but if I change more speed back to zero, we can
see move speed is equal to zero now and message is printed all the time.
Ahoy!
Something like that.
All right, Let's delete this and let's go to next video.