Naddox

example script - scr_move(arg)

Oct 28th, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. ///scr_move(collision_object)
  2. var collision_object = argument0;
  3.  
  4. //Horizontal Collisions
  5. if (place_meeting(x+hspd, y, collision_object)) {
  6. while (!place_meeting(x+sign(hspd), y, collision_object)) {
  7. x += sign(hspd);
  8. }
  9. hspd = 0;
  10. }
  11. x += hspd;
  12.  
  13. //Vertical Collisions
  14. if (place_meeting(x, y+vspd, collision_object)) {
  15. while (!place_meeting(x, y+sign(vspd), collision_object)) {
  16. y += sign(vspd);
  17. }
  18. vspd = 0;
  19. }
  20. y += vspd;
Advertisement
Add Comment
Please, Sign In to add comment