Movement

Now that we've gained a better understanding of how we fall, we can work on picking ourselves up and moving around. Click below to start a simple example of how we can move around the world using the arrow keys.

Notice anything?

If you pay close attention to the movement in the previous example, it should have been pretty obvious how we were moving. Well, at least the type of movement in the different directions. Gravity is an acceleration, as the previous example demonstrated it just feels more natural than a flat velocity. Probably because we're used to watching things accelerate as they fall. On a simalar note, you might have noted that the upward motion was also an acceleration. If you recal, I listed our gravity as 0.05, this is because for reasons beyond mortal understanding the authors of the HTML5 canvas feature decided that the positive Y axis is down, which isn't that big of a deal, but it does mean that our acceleration for ascending is -0.2, which might not seem like that much larger than our gravity on paper, but as can be seen in the example, it gets going pretty quick. Our horizontal movement feels really sluggish by contrast, even though at 1 it should be larger than either of our accelerations, because we accelerate at the rate of frames and not seconds, we increment our velocity about 60 times per second, so by the time one second has passed, we're already moving at .05 * 60 = 3 which is 3 times faster than our horizontal velocity.

Next
Previous