A port of Ray Wenderlich Bouncing Ball