Guest User

collision_rectangle_list

a guest
Jul 14th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @desc collision_rectangle_list(x1,y1,x2,y2,obj,prec,notme)
  2. /// @arg x1
  3. /// @arg y1
  4. /// @arg x2
  5. /// @arg y2
  6. /// @arg obj
  7. /// @arg prec
  8. /// @arg notme
  9. //
  10. //  Returns a list data structure populated with the ids of instances
  11. //  colliding with a given rectangle, or noone if no instances found.
  12.  
  13. var x1,y1,x2,y2,obj,prec,notme,dsid,dsmask,i;
  14. x1 = argument0;
  15. y1 = argument1;
  16. x2 = argument2;
  17. y2 = argument3;
  18. obj = argument4;
  19. prec = argument5;
  20. notme = argument6;
  21. dsid = ds_list_create();
  22.  
  23. i = collision_rectangle(x1,y1,x2,y2,obj,prec,false);
  24. while ( i != noone )
  25. {
  26.     ds_list_add(dsid,i);
  27.     instance_deactivate_object(i);
  28.     i = collision_rectangle(x1,y1,x2,y2,obj,prec,false);
  29. }
  30.  
  31. if ( !ds_list_empty(dsid) )
  32. {
  33.     var list_size = ds_list_size(dsid);
  34.     for ( i = 0; i < list_size; i ++; )
  35.     {
  36.         instance_activate_object(dsid[| i]);
  37.     }
  38. }
  39.  
  40. return dsid;
Add Comment
Please, Sign In to add comment