Put the hero's movement in a function