Add a direction function for pacman (keyboard event)