Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. scr_input();
  2.  
  3. horiz = rkey - lkey;
  4. vert = dkey - ukey;
  5. hspd = horiz*spd;
  6. vspd = vert*spd;
  7.  
  8. //Movement and collision
  9.  
  10. //horizontal
  11. if(place_meeting(x+hspd, y, obj_wall))
  12. {
  13.     while(!place_meeting(x+sign(hspd), y, obj_wall))
  14.     {
  15.         x += sign(hspd);
  16.     }
  17.     hspd = 0;
  18. }
  19.  
  20. x += hspd;
  21.  
  22. if(place_meeting(x, y+vspd, obj_wall))
  23. {
  24.     while(!place_meeting(x, y+sign(vspd), obj_wall))
  25.     {
  26.         y += sign(vspd);
  27.     }
  28.     vspd = 0;
  29. }
  30.  
  31. y += vspd;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement