Moved hero movement code into a separate function.