普通は x座標とは別に、進行方向を示す変数を持つもんだよ

if( x < 79 ) diff = +0.8 ;
if( x > 113 ) diff = -0.8;
x += diff;