Advertisement
Ulabael

Move Script

Jul 29th, 2022
966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var key_up = keyboard_check(ord(up)) or keyboard_check(vk_up);
  2. var key_left = keyboard_check(ord(left)) or keyboard_check(vk_left);
  3. var key_right = keyboard_check(ord(right)) or keyboard_check(vk_right);
  4. var key_down = keyboard_check(ord(down)) or keyboard_check(vk_down);   
  5. var movement_dir = point_direction(0, 0, key_right - key_left, key_down - key_up);
  6. var movement_input = (key_right - key_left != 0) or (key_down - key_up != 0);
  7.  
  8. if movement_input
  9. {
  10.     var h_speed = lengthdir_x(spd, movement_dir);
  11.     var v_speed = lengthdir_y(spd, movement_dir);
  12.     x += h_speed;
  13.     y += v_speed;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement