added code to animate the sprite