Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. //Retrieve hitboxes in the group from the owner of the hitboxes
  2. var _grouplist = ds_map_find_value(hitbox_owner.map_hitboxes, hitbox_group);
  3. var _size = ds_list_size(_grouplist);
  4.  
  5. var _hitlist = ds_list_create();
  6.  
  7. for(var i = 0; i < _size; i++){
  8.  
  9. var _inst_count = (instance_place_list(floor(x), floor(y), obj_hitbox, _hitlist, true)){
  10.  
  11. //If we actually hit something, loop through the list
  12. if(_inst_count > 0){
  13. for(var j = 0; j < _inst_count; j++){
  14.  
  15. //Put our current list index into a variable that's clearer to read
  16. var _inst = _hitlist[| j];
  17. //As long as the instance we are checking isn't noone (just in case) and the owner of the current instance is not the same as our hitboxe's owner, we can proceed
  18. if((_inst != noone) && (_inst.hitbox_owner != hitbox_owner)){
  19.  
  20. //We are hitting something
  21.  
  22. //Check whether the detected Box is on the list of targets. If not, we just ignore it and if it is, we proceed
  23. var _len = array_length_1d(hitbox_targets);
  24. var _parent = object_get_parent(_inst.hitbox_owner)
  25. var i = 0;
  26. repeat(_len){
  27. //Iterate through the targets array and ignore if not a target.
  28. //This is true when either the _parent is on the target list or the object_index equals an entry on the target list
  29. if((_parent == hitbox_targets[i]) || (_inst.object_index == hitbox_targets[i])){
  30. hitbox_ignore = false;
  31. } else { hitbox_ignore = true; }
  32. i++;
  33. }
  34. //Do the ignore check with the list in our hitbox if we passed the parent check
  35. with(other){
  36. //check to see if your target is on the ignore list
  37. //if it is on the ignore list, dont hit it again
  38. if(!hitbox_ignore){
  39. for(i = 0; i < ds_list_size(hitbox_ignoreList); i ++){
  40. if(hitbox_ignoreList[|i] == _inst){
  41. hitbox_ignore = true;
  42. break;
  43. }
  44. hitbox_ignore = false;
  45. }
  46. }
  47.  
  48. //If we are not ignoring the hitbox, we proceed with the processing of the hitbox
  49. if(!hitbox_ignore)
  50. hitbox_apply(id, other.hitbox_owner, _inst);
  51. }
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement