We define the Heegner--Drinfeld cycle on the moduli stack of Drinfeld Shtukas of rank two with r-modifications for an even integer r. We prove an identity between (1) The r-th central derivative of the quadratic base change L-function associated to an everywhere unramified cuspidal automorphic representation π of PGL2; (2) The self-intersection number of the π-isotypic component of the Heegner--Drinfeld cycle. This identity can be viewed as a function-field analog of the Waldspurger and Gross--Zagier formula for higher derivatives of L-functions.