Advertisement
SirCumferance

[GML] mouse_within (readable)

Jan 6th, 2022
2,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///mouse_within(x,y,x2,y2)
  2. // Returns true if the mouse is within the specified field
  3. // Written by GlitchDetector
  4.  
  5. var mx,my;
  6.  
  7. mx = mouse_x
  8. my = mouse_y
  9.  
  10. var x1,x2,y1,y2;
  11.  
  12. x1 = argument0
  13. x2 = argument2
  14. y1 = argument1
  15. y2 = argument3
  16.  
  17. var xin,yin;
  18.  
  19. xin = (mx >= x1) && (mx <= x2)
  20. yin = (my >= y1) && (my <= y2)
  21.  
  22. var is_inside;
  23.  
  24. is_inside = (xin && yin)
  25.  
  26. return is_inside;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement