if (x < xprevious) image_xscale = abs(image_xscale); if (x > xprevious) image_xscale = -abs(image_xscale);