Hey everyone,
I’m using a system where, at each tick/update, the keyboard is checked for state changes (keys being pressed and released). The player is moved according to what keys are pressed (W for up, A for left, etc.) Recently I was trying to limit the speed of diagonal movement and followed instructions from one post, telling me to move the player by
speed / Math.sqrt(2);
. This DID change the speed, but in an unexpected fashion. The player moved slowest when moving up and right, and fastest when moving down and left. Is this a rounding issue or something different?
My code: http://pastebin.com/GBaK435S
Thanks,
Will