add ball_collision function