So we've got these defined.
We've got variables to hold the player motion and
the change of motion in the X and Y.
You can see we've got a couple bulions,
which we did not follow that naming scheme.
So you don't necessarily have to follow that scheme, but
if I wanted to, one nice thing that you can do is you can rename these and
have it change everywhere in the script immediately.
So if you right click on facing right and go to re-factor and choose rename.
It will select the whole variable name and
if I scroll through It'll actually select them everywhere.
And then while I'm on that, I can just type something new.
So let me type underscore facing right and then hit returns.
So down here it says, accept, return.
Escape to cancel.
So if I do that, now everywhere in the script that it had,
just facing right will now be underscore facing right.
So I can do the same thing for is grounded.
Refactor that, choose rename,
do _isGrounded and the same thing for
is running, rename this as _isRunning.
And as we look through the script,
all of those variables will now be changed to the proper name.
So if I look down into the awake function, this is where we typically do our set up.
Either in a start function or an awake function.
Awake happens first and then start.
So if there's things that you wanna do before start,
you typically can do them in awake.
And you can see one thing I'm doing is I'm setting up all these private variables so
the _Transform = GetComponent=Transform.
So this is getting the transform component of this game object,
it's getting a reference to that.
Because we're gonna be potentially moving this through the transform,
we get the RigidBody2D component.
Get a reference to that cuz we're gonna be modifying that through code.
And in the past you might have just got the component
when you needed to adjust it, but that process is actually less efficient.
Unity takes time to actually access the component.
So if in awake we actually.