threshold_height = bottom_of_pipe_height + 10 pixels; // or something if (current_height < threshold_height) flap else don't flap