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
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
Russian
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
Let's out
Script to our play
So I'm going to do is
Is click on the route player mode
And then
I'm going to click the screen
Plus
Which says attach a new or existing Script To The
So go ahead and click that
And this is going to have bye
Play fault
Templates
But we don't
So go ahead and
Select instead
No
Default
And then your past should be the same path as your player seen
So was all the set
Quick create
And that sets us up
With
Very basic script that we can start
So again I'm not going to go over the basic
Programming but I will explain to
A bit about
Kiddle
So the Rain Man
Is cold
When the Node becomes ready in the sea
And the way this works is that the Node
Furthest down the tree
Becomes red
Subtitled by online-courses.club We compress knowledge for you!
And it's Perry
Only becomes ready
When it's parents children all day
Ready
And ready is
A moment in life cycle
Where it's indicated that
The note
In the scene tree
And everything is red
To use
So an artist
If we had a script attached to collision
This will become rare
And then the spray 2D would become ready
And then once both of these are ready then the player becomes
So what does means
Any kodi running the ready method
Memes that your children are already too
The process method
Is a function that gets called every single frame as indicated by
The comment
And delta is passed in which is the amount of time since the previous three
So this is how you can do movement in
A time B
Calculator
Ok before we write any code we need to set
An input map so that we can use
Wasd or arrow
Remove the play
So let's go ahead and go to Prodigy
The top project set
Go to the input
Tab this little toggle show building
It was already a bunch of preconfigured actions here mostly relay
The 2UA
Title designs you can see how this is going to
So all these UI actions
Are available for you to use if you want
Don't work I can figure out
You can go ahead and talk about that back off
I know what we're gonna do is we're going to type into this add new action
We're going to type in
Move
Left
Go ahead and hit enter to add
Let's do another one move underscore
And you probably know that working
How to do move up and move
So Angela
Borax
And now the weight of the input
Artworks is
You
Add an action with the name
And then using the plus
You can add
Any input events you want and as many as you
Under that are
The code but basically will just be able to ask
What is the moves
Action
And that will return true
If any of the events under me
Happened
So we're going to do that now so
Clicking the + button to the right of moves
And we see this
Dial
So we've got a couple of different things we can do
We've got joy pad access
Joypad button
Mouse buttons and
Keyboard keys
What is going to be doing mouse and keyboard for this course
So what we can do as we can
Filter by event
And when we click on this
Field we can actually just press a button on a keyboard
You get
The Intern
So I'm going to click
And once I'm done
I get a bunch of additional
Is here I can check any of these modifier keys if I want
And we have a drop down here that allows us to choose how the
Keycode is
Determined
Just going to keep it as physical key code for now
And click
Click the plus
And again
And we're going to press the lead
Carol
And then click
So now what we've done this we've said move left
Will Now work
For either the achy or the left arrow
So any control scheme that a player wants to use work
I'm going to do the same for me
D
And then we're going to
Right
And the same for
So add a new event press w
Ok
Add a new event
Press up
Ok
And the same for
So
And
This is what your action map should look
Alright go ahead and click close
Now we can go back to our place
So what we want to do is we want to get the direction of the player should move
But then I have to be
On
Inputs that
Where is giving
So go ahead and add to new line
Underneath the
Process to define in new funk
And this is going to be cold again
Moves
Vector
So this is how you define a new function in
Gdscript
You specify the function with
And then
It's recommended to use snake case
Or your function name
Can you put a colon at the end
And if your function doesn't have a body
You can write pass just as the
Do you appear so all the errors and
Go away
I'm going to do is I'm going to rain
Bar
Movie
Vector
Zeke
Vector
What is I doing that setting our moving vector to a 0-0
Select a vector
With a 0 component
In a while
And then I'm just going to save return move
Vector
And again
It's recommended to name your variables with
Snake case
No this isn't doing it
Sing I'll be asleep so we actually need to fill in this bar
And what I'm going to do as I'm going to save our
X movement
Is equal to
Input
Dart
Get
Action
Definitely use the autocomplete so
Action string
You can find it in the list using the app
And down arrow keys
Enter to autofill
And the nice thing about good L4 and get a generally is that it will detect what your actions are actually offer them as a
Spell complete
Suggest
So we're going to put in moves
Here and then we're going to subtract that from
Input
Get action strength
Move
Left
Salami maker
Edinburgh live
Bigger here
Stop what is this line doing
This input jet action Street
Returns an action string
Honour 0 to 1 scale
Now with a keyboard it's a binary state
The key is either pressed or it's not
So this is always going to return zero or
1
However
If you're using
What's a a Joyce
That will return
A fraction or a decimal number
In between 0 and 1
Based on how far
You've pressed the sticker
Again when I come in to get into that in this course but this is
Does
And it's get actions
Here we'll return 1 if we press right
Was some tracking that from the get action strength of moves left
Which is
1 if left is
So what we're going to end up with
If
Moveright is not press
And move left is pressed then RX movement is going to
Negative
If right is pressed and left is not pressed then we're going to get one
Both of them oppress
We're going to get 0
X movement is basically telling us which direction we want to move the player in
And we're going to do the same for a while movement so create another variable called why me
And this is going to be the same exact thing basically someone to copy this for
Experience
A letter
So what you need to know is there
The down direction in the way
Is pasta
So
Thinking about that
What is the proper order that we need to do
To get this to work
When you're subtracting the positive
Always goes first
So mu
Down
Should be our first
Input action here
And then move
Up
And again because down is positive
And up is negative
In the war
Ok so what I'm going to do if I'm just going to instead of returning our movement bacteria let's return vector 2
Use parentheses
And we can just put our x movement and our way
In there
We actually don't need this movement Factor appears I will go ahead and
So there's our method it's going to return to us essential
What the input state is
Sauna process made in let's go ahead and grab
So we're going to save our movement vet
Is he going to get
Movement
Now we need to pull out the direction
Can you maybe saying why can't we just use this as the Direct
Thing is because let's say that you
The writing for press and the up
But you'll get is a vector that is
11
Which technically has a lie
That is greater than
If you take that back
And you X let's say some speed
You actually exceed
The target speed because the
Is greater than 1
So we actually need to normal eyes
This input VAT
So that we get a vector that has a length of 1
So that when we moult
Quiet everything will
As expected
And you can definitely experiment with this with
Normalizing at to see exactly what I'm talking about
But we're just going to go normal
I'm going to save our direct
Is equal to
Movement vector
Norma
So that will return a unit length of Vector
Also known as a vector
Next one
The how are you
Well we should probably define a speed of 4
Character
So what I'm going to do it
Subtitled by online-courses.club We compress knowledge for you!
Underneath
Extend the character body 2D
Going to add a couple of new Lines
And I'm going to say
Can't
And this simply just marks a variable
That cannot be chewed
So I'm going to say
Max underscores
And generally I like to use all car
For constant variables so that I know that they're special and cannot
What's a r max speed do something like to
So we got a max-min here
Now let's go back to our process method
And we're going to say
Velocity
Now where is this velocity coming from
Velocity is actually a property of care to body to die
So let me show
If you press F1
That will open up the documentation within the engine
So go ahead and press F1 and search for character body 2
Guiding light to bring it on
Open up the character body to the document
Now again I'm not going to go over the basics of programming and I'm not going to go over the basics
Reading documentation
Just know the documentation is available in engine so you can see exactly the capabilities of every know that
So have you got a kick about it today you can scroll down
You see all of these properties in all of these
So this is where are velocity is coming from it's a vector to write here
As on the character body
Severus say anything in a script that we haven't previously defined
It's likely that is coming for
EBay
So what do you want to do what we want to set our Velocity right so we say velocity is equal to
Direction
Time
Mark
What that will do is that will send a sad 200 pixels per second
In the direction that we've
Now this is not been waiting we need to do that we need to tell the character body to actually move based on the
So what we're going to do is really call me
Slough
Now if I look at my care about you today what is moving slides say it's all going to go down and click on
Reuben slide says it moves the body based on
Very simple and
What does will do is this will take the velocity
And it will perform any collisions that need
Happened and it will return
Any remaining
From a collision
So you can imagine
If you are going diagonally against a wall
You're going to want to stop the characters from
Me in the wild
Directions of your going up against the
What does stone
Text component to the movement because he's going down
So moving slide
Will the zero out the Y component of the blood
But use the remaining excellence you to continue move
The character body
And so this is really nice for creating smooth
Collisions where the player still has
And this will modify velocity under the hood
Which is useful when you're doing
Things like accelerate
Which will get into in
Future let's
So everything is correct we should be able to me
But
We don't
Have a scene for the player to move around
So let's go out and do that
So let's go back to our 2D mode up here by clicking the 2D button
Let's go to scene at the top news
And the new scene window here
What's quick other now
And use a node based
I'm going to rename this to main
And I'm going to see it
I'm going to go into my Simms directory
I'm going to right click into here click a new phone
And bright
Main
And then I'll say
So we should have a main scene under the rest seems me
Main
80s
Why we need to do this
This is going to be
Our amazing this is going to be where the game
Takes place
This is where we can add h
Player
So what's right click on mean
What's quick instantiated child scene
What this does is this
Allows us to take a pre-built scene and put it into
The sea network currently
I'm going to go ahead and click that and then click on player
And now you can see that our player and all of its configured nodes are represented here as a single now
And I've got a couple of nice buttons your friends and they want to edit the players in I can collect this awesome button here
And I'm back to the place now watch this
I'm just going to do this for demonstration purposes you don't have to do that
If I add a colour rectangle here
Which is basically a big white square
Can I go back to my main
Wicked
So any changes are made to the player is reflected
In this play scene
And in the main
So you can probably already see how we're going to be using
These
Various different seems to build out
Largest
And a nice thing is that
The pleasure is all nice and so
Contained
So that way any changes I make here will be reflected at
That's all instances
The player across
The game
Which will only have one player in the game but it'll be really useful when we start making a
Ok
So let's go ahead and take the player and move
Movie
The origin of little bit so just drag him down to the right
And then go ahead and click the play button
Add the top of the window and you can also press F5 if you
Now I will get a warning that says we don't have a main c
Godot needs to have a scene to find which
The first seen it loads
When your game store
And so we're just gonna go ahead
Current if you've ran the game from the main c
Be careful not to Run the game from the pliocene because
Select
You'll be running around
So make sure that mean is selected
Go ahead and click play and then select
So the game is start
And
If you got a configure the same as me
You'll see what the player is
Very very tiny
If you use the wasd and arrow keys you can see that our player is moving
Quite well
Now obviously we still have a lot of work to do with the plane
But that is basically remove
In the next life
Will setup a proper window scales
Turn the players
So tiny
And then will also start work on creating an environment for the player to walk around
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.