Set flap_height = bottom of next pipe + constant.
If bird height < flap_height, flap.
Done!
threshold_height = bottom_of_pipe_height + 10 pixels; // or something if (current_height < threshold_height) flap else don't flap
Set flap_height = bottom of next pipe + constant.
If bird height < flap_height, flap.
Done!