neonblack

RELLO!!

Sep 6th, 2014
242
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Horizontal Colission
  2.  
  3. if hsp > 0
  4. {
  5. if collision_rectangle(x-16, y-32, x+15+hsp, y+31, obj_par_ceiling, true, true)
  6. {
  7. while(!place_meeting(x+sign(hsp),y,obj_par_ceiling)) x += sign(hsp);
  8. hsp = 0;
  9. }
  10. }
  11. else if hsp < 0
  12. {
  13. if collision_rectangle(x-16+hsp, y-32, x+15, y+31, obj_par_ceiling, true, true)
  14. {
  15. while(!place_meeting(x+sign(hsp),y,obj_par_ceiling)) x += sign(hsp);
  16. hsp = 0;
  17. }
  18. }
  19. x += hsp
  20.  
  21.  
  22. //Vertical Colission
  23. if vsp > 0
  24. {
  25. if collision_rectangle(x-16, y-32, x+15, y+31+vsp, obj_par_ceiling, true, true)
  26. {
  27. while(!place_meeting(x,y+sign(vsp),obj_par_ceiling)) y += sign(vsp);
  28. vsp = 0;
  29. }
  30. }
  31. else if vsp < 0
  32. {
  33. if collision_rectangle(x-15, y-32+vsp, x+15, y+31, obj_par_ceiling, true, true)
  34. {
  35. while(!place_meeting(x,y+sign(vsp),obj_par_ceiling)) y += sign(vsp);
  36. vsp = 0;
  37. }
  38. }
  39. y += vsp
RAW Paste Data