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 (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
We've got a basic player and we've got
A basic
So let's get some camera movement working so we can actually
Traverse the
And be able to see what's going on
What I'm going to do is I'm going to create a new scene by going to see in new SIM
And we're gonna start using hotkeys now that we've done this a few times through the UI
So the hockey create new scenes is control
And that will automatically bring
To the new sim creation
Can you can hit control a
To bring up the add node dial
So again that's control End to start a new scene
And then control a
To open up the ad no dialogue
What I'm going to do is I'm going to search for camera too
And I'm going to enter
To add
To my
Scene
I want to rename this to game camera
And the recommended style for naming your nose by the way is Pascal case for
Good names and
Subtitled by online-courses.club We compress knowledge for you!
Case for basic
Everything else
So we received
What's inseam
Create a new phone
Game underscore camera
And we're going to say that
Game camera
What's going on at a script
And we're going to keep the same thing that we have last time so no
Default for r temple
And then
The default
Is fine
So where can I go
Create that
So whatever you want to do it
Well every frame we need to update
The cameras
But first we need to tell good girl to use the curry
Camera so in Godot
You can have multiple cameras in a scene
In the camera that surrendered
Is based on what camera is the current camera
And so the way that were going to do that is there just going to in the ready method or reply
Bus pass line
Current
I was going to go and save
So when the camera is ready it will be made
To me the current camera
And then in process we want to follow the player now
How do we know
What the position of the player is within the game camera
What we can do as we can use groups for that
So I'm going to go back to my main
I'm gonna click into
Best player seen here
Click open in editor
The only thing that you can
Is you can hit control she
And then
To bring open the quick
Window and then you can search for your scene by name
And double click it
So your top players
If I click on
Root node and then go to the Note Tab
The inspector
Or wherever it is in your edit
There's a groups button here which
And now I can add the player to it
Try and manage groups if I'm
To do it this way
And I can type in here into this box
Player
And click
So I've got a player group config
And then I've got all these nodes that are
I want to add the route player no
To the player
By clicking the player note in
Snowden
In group
And then click
Add
Click ok
So why group guys is it essentially an identifier that can be accessed from anywhere
In the cold
We're going to be able to get
All the nodes in this player group in order to find
Aeroplane
I might go back to my game camera scene in open up the Script
By clicking the Script button
In our process method what we can do is working to replace this past line or going to say
Tree
Which gets the current steam train
Get nose
And then
Player
And then we can do as we can save our
Play nodes
No notice I said clear loads here and notice out this says get no
Group forget nose and group function return
Every note that exist in the playgroup
Which means that a return
Tenerife
But only interested in the first result
What can I do in if statement
Clear nose
Die
Size
Which of the funk
So checking the length of player now
Is greater than 0
Then we're going to put the Colin at the end in
Ingenious
What tabs are the way that blocks are the term
It's kind of white Python in that sense
So if statements need to have
All of the block indent
Functions need to have all their blocking
And so on and so forth
So far player knows that size is greater than 0
Then what we can do as we can say
Via player is equal to player mode
And then we can drop the index
And this is similar to other programming languages use the brackets
And then the index that
I want to get
So when we do it display
Well the simplest thing to do it as we can say after
Is equal to
Claire
Global
Position
Now you'll notice that you're not getting in tallaght sense here
When you
Two player dart global position
And the reason is
Godot does not know what the type of
Play it
We know that it's a no to die
That has global position
Qudos
The only thing that's returned from getting those in group is an array of a node
Justin
Because that's the bass type that all notes inherit
And so that's the safe way to return
All the nodes in a
So imagine
If I had in the players
Another note type that was like a control now
Or
Clean nose
I can have a mixture of nodes in this list that's Returned in this array data return
That
Do not have a global position
And so that's why it does not recommend
Global position here because it doesn't know what the exact
Now if you want
What you can do to get that intelligence is you can say
Since we know the type of
You can say I want to grab the first player note
As
A note
And so that's going a cast
Player variable
To type notes
And then we can say player that global position
See how we get all of our lord to the related
Please in our
Going to be using tights to heavily however
We will sometimes use it when it's convenient
For intelligence
You can
Fully type your gdscript using static type
That's not something I'm going to spend too much time doing in this course but just knows
You can use types everywhere
And actually I don't think we don't want this to be the opposite were just going to
The cameras global position
To be equal to
Can you play
What position offset is a property that you more so
To use for screen
Something to run this
And see if it works
And is not working
I think for a second why it's not working
If you answered because we haven't added the game camera to our main scene
Then you're right
This is going to happen all like when you're building your dog
If your new tikitail you'll be running your seen wondering why a change you made is not working
That's because we
Built the camera in isolation here
Lights on
Scene
We haven't added that seemed to our main
So let's go ahead instantiated childnet again
By right clicking on me
Instantiate child scene
And then
H camera
And I want to put the camera
The first child in the sea
This is one note that is not affected by draw order the game camera
Does not take to order in
A counter when it's rendering
So I just like to put it first so it's kind of out of the way
So now what
And now you can see
The camera is full
IPlayer
What's with the camera a little bit nicer by introducing smoothing to the camera
So most games your notice when you're playing
The camera is not
100%
To the player
Actually has a slight drag behind it
While you're moving
That's because
Most
Professionally made games have cameras
That are smooth
Which means that they don't
Just automatically set themselves to the position they actually have a little bit of travel
Which makes them feel a lot more now
We're going to do that is we're going to
Is framerate in
Dependant
So
We've got our camera script here so go ahead and open the car
Back up I'm going to do is at the top of the
Create a new variable
Target underscore position
And then you can is initialised
Two vector 2.0
Which is the constant for
SE2 0xn 0 Wykeham
Instead of setting the global position herein meaning
Order do instead is we're going to assign our target
Tool the player glow up
Ok and we're going to remove that line where
Set the global position
And now I'm going to do as I'm actually going to take this and terrible
Cut it out
Add a couple of new Lines
So the guitar recommended silent
Two new lines in between
Switch function
So that's why would you ring me
Call this a quiet
We're going to open and close parentheses and then put a corner
And paste our code in
And we're seeing an aerosol can
Passing the process for the air stop
And we need to
An extra line
What the proper spacing between
Acquire target is going to do
Is just going to assign
The target position but only
What's the player
Sonar process method
We're going to call
Just like
And so that's going update our target position everything
And then we're going to blow up position
Is equal to
Global position
And loop stands for
Linear interpolated
Linear interpolation if you're not
Familiar is basically having a star position in any position
Subtitled by online-courses.club We compress knowledge for you!
In specifying a percentage
That represents the percent of the distance between those
To possess
So another word
If I have
Point a witch
10 pixels to the right
And point B which is at the origin
0
Then alert of 50%
Would return to me a position that is 5 pics
The percent that you pass into a linear interpolate represent
A point
Between the two supply
That is
The supply
Percent
Between
Hopefully that makes sense but you're going to see how it works
Real quick general make
So I'm going to learn from Cameron's current position
To the target position
And this is where our DELTIC
In a place so I can put something like .5
In here that's going to say is every frame
Move the camera
50% of the way
2
That's essentially just going to be stuck to the player because if you're games running at let's go 400
Basically after three frames it's going to be on top of the player
Add a player
Is not going to notice
Camera smoothing at all
This is why we're going
Framerate independent live
It's a way of doing lerping AKA
Smooth
That is independent of your favourite so I could run at 1000 frames per second and would still behave the same as of the
Where was running
At 10
The way that we do this is we take
1.0
Minor
And you can either
How
Here
And provide
A base
I like to use
Which is the natural x
Which actually gives
A very natural feeling smooth
So we take 1.0 -
In for a float we want to
The negative Delta
X
And we have some smoothing value so we're try 10
Bradford
Now
This mathworks
I'm going to attach resources
In this lesson with links
Explains the exact mathematics behind this
I just know that
This formula where you too
One point
The natural exponent
Which is a mathematical constant and then raised by some negative power
And that produces
Mouth that makes it
So again if that's not quite clear in the mouth and don't worry we're going to be using this sort of Formula 4 article
How to create smooth learning
Anna create a really nice
Feeling effects
What's going to run the game
And now you can see if you move around
That your camera is dragging behind the players
And when you stop
The camera takes a few frames
To Settle on the place
Position
Great
So that's it for this lesson with our camera done
We're going to move on to
Working on a basic enemy
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.