Vector Movement

by Zecronious
Upgraded pixel movement, allowing movement like in the real world. Super smooth.
ID:1751630
 
Applied a bunch of useless optimizations. Why? Because.

Seems to be pretty buggy with Gravity on, It's cool tho c:
The process of going from keys (upKey, downKey, etc.) to direction (Demo/Movement.dm) to x/y components (applyForce) can be simplified:
// this would go in your movement loop

// since anyKey can be 0 or 1,
// input_x/y can be -1, 0, or 1
var input_x = rightKey - leftKey
var input_y = upKey - downKey

// if you want diagonal movement to have the same speed
// as movement in a cardinal direction,
if(input_x && input_y)
input_x /= sqrt(2)
input_y /= sqrt(2)

// At this point, (input_x, input_y) is the unit vector of your force.
// You multiply it by 5 to give it a speed of 5.
apply(input_x * 5, input_y * 5)