# How to make your GAME feel AWESOME

### Making you games FEEL AWESOME

In this tutorial, I will explain to you how to take the player movement in your game to the next level: by adding acceleration, friction and all sorts of goodness.

I will teach you the equations needed to implement that on your own game (no matter the game engine) as well as how you some code example.

This is clip from the "How to Program a Game in C++" tutorial series. If you want to learn more about game development, be sure to check them out here: https://www.youtube.com/playlist?list...

I hope you enjoy it!

### Tutorial Transcription:

Now let's learn about the equations of motion so we can make out player movement feel great!

Previously, we added a position variable that we incremented every frame, by an velocity amount.
The velocity is the rate of change of position in time, so we can call that the derivative of the position.
What we want to do, is to make the velocity have its own variation in time. So that it picks up speed over time.
So the derivative of the velocity will the acceleration, which is the rate of change of velocity in time!
So when the player presses the move button, instead of changing the velocity, we'll change the acceleration.
Since the acceleration is the change in velocity over time, we can easy calculate the new velocity by adding the old velocity to the acceleration times the delta time. Pretty much like we were doing before!
And now for the position. Since we are considering both the first and second derivatives (the velocity and the acceleration) our equation has consider them both.
So the new position will be the old position; plus the velocity times the delta time (like we did before, since it's the first derivative); plus the acceleration times the delta time squared, divided by two.
If you want to know where this equation comes from, you can watch calculus lessons online. Khan Academy has great videos on that!
Now let's program that!

I'll have to store the velocity across frames, just like the position. I'll call that dp, since it's the derivative of the position, like we discussed.
The acceleration, called ddp (since it's the derivative of the derivative of the position), I'll create every frame, because I'll only accelerate the player the frame the key is being held.
So if it's down, I'll add acceleration.
Now all I have to do is to add those equations we discussed: the equation for the p, considering both derivatives, and for the velocity.

Look at that! We already have nice and smooth acceleration.
But it feels like we are floating in space... Because we have to friction!
The friction will be a change in the acceleration, and it will be based on the velocity. That simple. Those values we can tweak to get the game exactly how we want it: maybe more Super Meat Boy-like, or maybe more like Mario. You got the idea.

Now we have an awesome movement! And that feels really nice to control!