detects collisions with walls and resets the ball