change directions onkeydown for better responsiveness