Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Alright so now we can go ahead
Jump into a new player script that we created
Actually start doing some code
Allow player to move
The first thing I want to do is actually extend the new player
Night necessarily to the monobehaviour
Actually first
2D physics object
Script
Created
I'm going to be doing a lot of this
In his game kit actually I think the only time that week's standard to anything
Are new players actually an extended a physics object because we wanted to have it love properties
The physics object script
Create
In that case a gravity modifier
That is specific
Two physics objects
I really want to use rigidbody gravity because our physics logic gravity is going to be much more specific
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
To our 2D platformer and give us a little bit more control
That's all we're going to do here we're just going to extend to physics object now it's a physics object
Extends to the Mario Javier so the new player script
Actually does extend to the monobehaviour through the physics object
Space Leeds
Current Script if you will
Was Aladdin properties that allow it to move in a very specific way
Stop we had Sophia jump back in the unity even though we have our gravity scale on the
0
A new player script because it extends to the physics object
Actually gonna fall
Because the physics object has its own gravity
Independent of the rigid part
IPlayer is now falling
In order to get iPlayer to move we actually need to manipulate
Property in the physics object
Or a variable in the physics subject
Cold
Velocity
Without getting too much in the weeds here the target velocity is actually going to change the velocity of the physics object
And moving around
Tesco two new player here
You know that if we actually type in Target velocity
Automatically recommended a variable called Turkey velocity
We haven't actually declared as variable or
This variable anywhere in the new player script
That's because it's a variable associated again with the physics object which were extending two so we can actually use it and
So we can say target velocity equals
Say
1
Why do we have a red zig zag underneath this love we have a Rover it says cannot implicitly convert type
Integer
To Unity vector2
Well what I mean is Target velocity is a vector to meaning it's an X in a y
Vector3 if I just three has a Z axis of acta2 is just x in y
Go to a line 2D games because we don't need a change of Vectra 3 and you can go to the physics object to actually see
Score of the top here
Travelocity is declared in it's a vector 2
Send this to a new vector to
Sophie Collet new vegetarian
I see one and then 0
You say that out what happens inside of Unity
Take a look
Play
Man united players moving to the right
Survey of 1 and then Falls have to map
Just like we did in the previous tutorials
What we just said this to our actual input values
We can do new vector2
Input.get access
Horizontal
The why we don't want it to be moving in the Y Direction currently
Do it for now
Bus driver sound
Perfect do we move our player
The left and right
Let's be sure that we can actually change how fast the player is actually moving
What we can do is actually
New variant
Mummy share them is a serialised variable
N18 sure that it's a private for now it's going to be a float
Max speed
Buy the Falklands make it 1
7 unity
Soccer player here
You can see here that we have 3 properties
Popped up
Component
These two are associated with the
Standard behaviour script which is the
Physics object
Make a worry about these at all
What is the max speed we going to change this to 3 if you want to make it a little bit faster the plane
It's a little bit slow when we speed up a little bit
So why are we not getting an effect
Our player
If you guessed it that means you're learning
And you're actually better than me we need to multiply
X max speed
Are horizontal axis value the float value
When we press the left or right button
Is there a x x 2 speed it so if you press the right button
Goes to 1 we x x max speed which
Is wine here but if we go to Unity editor is actually three so it's going to be 3
Unless to be -3
Play and try again
Here we go
It is
Moving left and right
That looks great
If you follow along in the
Unity basics
Portion of this tutorial
You may be wondering
Thomas we actually at the x x x deltatime anytime were moving an object
The answer is yes so we should go to our target velocity here
Are we actually iterating anything in this script in the single line by Italy I mean
Increasing any value
We increasing at a specific frame rate
Actually no we're not using any sort of plus equals here
Are we doing a setting a value target velocity
To another value
What is Target velocity actually doing if you go to the physics magic script
Velocity
Type in Target velocity by pressing ctrl f
Search where it's been used in physics Optics script
You can see them velocity actually matches our target velocity here and was some clever maths when I can only get
When you can notice that a delta position has been created
And that is being multiplied
X x delta time
Tell this may look a little bit confusing don't worry about it too much but just know that we are actually
Multiplying x x deltatime
And we don't really need to worry about doing it right here
Because again
It's actually been calculated right here
So where do you want to play a to jump
What if we go into our new player skript universe we use target velocity when moving the player to the
Play in left
But I getting too much in the weeds here if you go to the physics object script you noticed that target velocity
Informs what the actual velocity in the x-direction is velocity is part of the
Velocity in the x-direction it's not really part of the equation for velocity in the y-direction
So we can actually just manipulate
The lottery itself
To create a jump
Because velocity is a very well that new player actually can manipulate
Why we can say equals 10
See what happens
Stop he flies up in the air
He's just flying
That's great so
Is doing well we need to do kind of the reason why he's lying because again
Update so velocity that why is constantly set to 10
Meaning his velocity is constant 10 and it's projecting him up but it's almost as if fuel is being
Rejected from his feet and is flying into the atmosphere
So you don't want to ask me that white always be 10 so what are we going to do here
Create a condition
And let's write some pseudo code here if the player
Prices
Jump
Set the velocity
2
A jump
Power value which in this case is 10
So again guys is your comments any time you see these two little / here there's a comments
So what is the jump
Input value
Are we going on unity here and we go back to our project settings
You can see that
Because these down
You can see that jump
Is actually
Fighting type
So when I can use get access to actually going to use get button
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
So we can type it like this
Input
Get button down
Jump
Make sure you use your curly brackets here
Is going to set up velocity that's why
The 10
Play here
What happens
Alright
That we've got a jump here
That's wonderful a question that popped into your head
And if it did
Granule
Penneys why is it the weekend manipulate the Y value of the velocity
We are meant to be like the Y value of a transform so transform that position
Why
Equals 10
Why is that
Well it's because as you can see here we cannot modify
Return value of transform deposition
Because it's not a variable
This is a vector 2
And it's a variable
Transfer deposition is an actually a variable
In order to do that you actually remember you have to do new vector3 and then you have to type it
This way
Something like that
Can I tell you modify a transformer value in a transfer value can be
Position rotation scale
But we can manipulate the Y value in the X value and Z value of a vector 3
Variable or a vector to variable so just keep that in mind as you're working on your game
Do you know this we can actually double jump
Wait now
And that might be cool in a jumper game
Purposes we only need one jump
So how exactly do we do that
Well there's a beautiful wonderful
Convenient variable
In the physics object Script if you press ctrl f
To find a variable
It's called grounded
And like I said the physics object script is a very complicated one
And one of the reasons why I use it so often is because the grounded variable is a very important
And it uses all is weird Matthew
To calculate where they were actually grounded meaning are we touching the ground or have we left
Round is a very simple very boards a bullying in 80 the true or false
So we got to do is
Create an additional condition here
In what you do that is you use the end sign
Not once but twice as just the syntax
So if the player presses jump
And
We are grounded
Set the alarm 30 so are you doing
Grounded
Is set to wait when is it
True
Soliciting weird syntax here let me try and explain
Anytime we want to use the word end or the sign and just used two of them and
Anytime you want actually check to see if a value is true or false you can use to equal sign
Not one we try and use one and save it
Jump in unity
Should get him there here
The left hand sign
An assignment must be a variable
Property
Orient Exeter
Did you see the universe can I confused
Doesn't really understand what we're trying to do here trying to set a value
You can set a value outside of a condition so for example we've set the last 30 to 10 with the ick
Well I'm really setting a value in this condition are we
Actually checking the value
That's why you use
2 equals signs
Anytime you're inside of the printer sees of a condition
Anytime you really checking to see what a value is
Can you use two equal signs
You going to be using two equal signs of the time when you're scripting in your eyes going to be using
Do anal signs all the time when you're scripting
Let it play
So because of the ground is here
Until we're grounded again
Curly kale
Perfect
Alright that was easy
Now sometimes you want to clean up code after you've written it and it works and you know works in fact the out are you there
Best to clean up your code after you know it works
Why no we can probably actually just remove all of this
In by the fault unity understands that if we say and grounded really saying is in grounded
Equals true
If you wanted to check and see if it was false
We either do it this way
If granted = false
We can do it this way
We could remove this
And use an exclamation mark at the beginning
What's another way of writing
Equals Force
Because we want to check to see if it's true
All we do is there
We press the jump button
And
We are grounded
Lottery is going to be 10
Just double check make sure the back code clean up
Actually works
Awesome
Very good
Everything works
And we can be girl with the next section
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.