added animation code

player doesn't always move in the correct direction