External Exam Download Resources Web Applications Games Recycle Bin

Diagonal Movement Problem



In poorly designed 2D games, where the camera is viewing the player from a top-down angle, players that move one "unit" right, and one "unit" up, may also move that distance diagonally if both up and right are pushed simulatenously.

However, this results in the player moving diagonally at a rate of 1.414 times faster than they would move right or left:


To fix this, diagonal (i.e. simulataneous) keypresses should be checked for, and if this is the case, the speeds should be "normalised", so that the speed right or up is equal to the speed diagonally. You could do this by multiplying the diagonal speed by 0.7ish.. but there are better ways.