Advertisement
Purianite

Untitled

Mar 20th, 2012
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Kizuna's movement
  2. // move forward
  3. if keyboard_check(ord("W"))
  4. {
  5.     nx = x + lengthdir_x(movespeed,direction);
  6.     ny = y + lengthdir_y(movespeed,direction);
  7.     if !place_meeting(nx, y, obj_wall_basic)  //check if object in path
  8.         x = nx;
  9.     if !place_meeting(x, ny, obj_wall_basic)  //check if object in path
  10.         y = ny;
  11. }
  12.  
  13. //move backwards
  14. if keyboard_check(ord("S"))
  15. {
  16.     nx = x + lengthdir_x(movespeed,direction+180);
  17.     ny = y + lengthdir_y(movespeed,direction+180);
  18.     if !place_meeting(nx, y, obj_wall_basic)  //check if object in path
  19.         x = nx;
  20.     if !place_meeting(x, ny, obj_wall_basic)  //check if object in path
  21.         y = ny;
  22. }
  23.  
  24. //strafe left
  25. if keyboard_check(ord("A"))
  26. {
  27.     nx = x - sin(direction*pi/180)*movespeed;
  28.     ny = y - cos(direction*pi/180)*movespeed;
  29.     if !place_meeting(nx, y, obj_wall_basic)  //check if object in path
  30.         x = nx;
  31.     if !place_meeting(x, ny, obj_wall_basic)  //check if object in path
  32.         y = ny;
  33. }
  34.  
  35. //strafe right
  36. if keyboard_check(ord("D"))
  37. {
  38.     nx = x + sin(direction*pi/180)*movespeed;
  39.     ny = y + cos(direction*pi/180)*movespeed;
  40.     if !place_meeting(nx, y, obj_wall_basic)  //check if object in path
  41.         x = nx;
  42.     if !place_meeting(x, ny, obj_wall_basic)  //check if object in path
  43.         y = ny;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement