l = keyboard_check(vk_left);
r = keyboard_check(vk_right);
u = keyboard_check(vk_up);
d = keyboard_check(vk_down);
h = 0.3 * (u or d);
v = 0.3 * (l or r);
x = max(x - (move_speed and l) *(l - h),0);
x = min(x + (move_speed and r) *(r - h),640);
y = max(y - (move_speed and u) *(u - v),0);
y = min(y + (move_speed and d) *(d - v),480);
r = keyboard_check(vk_right);
u = keyboard_check(vk_up);
d = keyboard_check(vk_down);
h = 0.3 * (u or d);
v = 0.3 * (l or r);
x = max(x - (move_speed and l) *(l - h),0);
x = min(x + (move_speed and r) *(r - h),640);
y = max(y - (move_speed and u) *(u - v),0);
y = min(y + (move_speed and d) *(d - v),480);