function scr_plat_set_difference() { switch (dif_type) { case 0: case 1: dif_x = sign(x - xprevious) * max(abs(hspeed), abs(x - xprevious)); dif_y = sign(y - yprevious) * max(abs(vspeed), abs(y - yprevious)); break; } }