It's a collision test. If right arrow is down check the right side (if there is a wall at right). If there is no wall player moves to right. But if player pressed more than one arrow keys collision check is failed. Here's my solution. Thanks for your ideas.