Gravity

Hopefully you know that in the real world gravity acts as an acceleration, meaning that the more you fall the faster you go. In games, we can choose if we want it to work this way or not. Choosing what type of gravity we have is a fundamental choice in how our world is going to feel when we move around. Click the buttons below to get a feel for the two types of gravity we could use.

So?

Now that you have a better feeling of our options in terms of the gravitation or our world, we can better compair it to what keeps us on the ground when we're not double jumping over spikes. As you well know, our gravity on earth is an accleration due to force. No one really knows why gravity works, but it does so we just kinda go with it. Not much else we could do really. The rate of acceleration caused by earth on an object of any mass is commonly refered to as g. On the surface of the earth (where most of us spend most of our time, even planes basically still the surface(earth's really big yo)) g = 9.81 m/s2. Which means for every second you fall, your speed, or velocity (technically the magnitude of your velocity) increases by 9.81 meters per second. Thats pretty crazy when you think about it.

Because we render our world on a computer screen, our g is going to be a little different. For the previous examples, the velocity for the block with a fixed gravity is 0.5. Now the engineers and scientists read this are probably freaking out because there aren't any units. But that's where they're wrong. Well, not technically I guess, but in our happy little world there's no such thing as "meters" or really even "seconds". Games work like movies, by drawing a bunch of images in rapid succession. So if you want units, think of our gravity in terms of pixels per frame. For more in depth break down of how my code in particular is working, please refer to Github repository for this project linked on the about page. If you don't know what a Github is, don't worry, you're probably a normal person.

Next