SHARE
TWEET

Top Down Collision Code

rooksword Aug 13th, 2019 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Horizontal collision
  2. if place_meeting(x + hsp, y, obj_wall)
  3. {
  4.     while !place_meeting(x + sign(hsp), y, obj_wall)
  5.     {
  6.         x += sign(hsp);
  7.     }
  8.     hsp = 0;
  9. }
  10. x += hsp;
  11.  
  12. //Horizontal collision
  13. if place_meeting(x, y + vsp, obj_wall)
  14. {
  15.     while !place_meeting(x, y + sign(vsp), obj_wall)
  16.     {
  17.         y += sign(vsp);
  18.     }
  19.     vsp = 0;
  20. }
  21. y += vsp;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top