Improved character movement logic.

A kepress array is now used to track the last key pressed so that we can make the character move in that direction only.