Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var key_up = keyboard_check(ord(up)) or keyboard_check(vk_up);
- var key_left = keyboard_check(ord(left)) or keyboard_check(vk_left);
- var key_right = keyboard_check(ord(right)) or keyboard_check(vk_right);
- var key_down = keyboard_check(ord(down)) or keyboard_check(vk_down);
- var movement_dir = point_direction(0, 0, key_right - key_left, key_down - key_up);
- var movement_input = (key_right - key_left != 0) or (key_down - key_up != 0);
- if movement_input
- {
- var h_speed = lengthdir_x(spd, movement_dir);
- var v_speed = lengthdir_y(spd, movement_dir);
- x += h_speed;
- y += v_speed;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement