Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Retrieve hitboxes in the group from the owner of the hitboxes
- var _grouplist = ds_map_find_value(hitbox_owner.map_hitboxes, hitbox_group);
- var _size = ds_list_size(_grouplist);
- var _hitlist = ds_list_create();
- for(var i = 0; i < _size; i++){
- var _inst_count = (instance_place_list(floor(x), floor(y), obj_hitbox, _hitlist, true)){
- //If we actually hit something, loop through the list
- if(_inst_count > 0){
- for(var j = 0; j < _inst_count; j++){
- //Put our current list index into a variable that's clearer to read
- var _inst = _hitlist[| j];
- //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
- if((_inst != noone) && (_inst.hitbox_owner != hitbox_owner)){
- //We are hitting something
- //Check whether the detected Box is on the list of targets. If not, we just ignore it and if it is, we proceed
- var _len = array_length_1d(hitbox_targets);
- var _parent = object_get_parent(_inst.hitbox_owner)
- var i = 0;
- repeat(_len){
- //Iterate through the targets array and ignore if not a target.
- //This is true when either the _parent is on the target list or the object_index equals an entry on the target list
- if((_parent == hitbox_targets[i]) || (_inst.object_index == hitbox_targets[i])){
- hitbox_ignore = false;
- } else { hitbox_ignore = true; }
- i++;
- }
- //Do the ignore check with the list in our hitbox if we passed the parent check
- with(other){
- //check to see if your target is on the ignore list
- //if it is on the ignore list, dont hit it again
- if(!hitbox_ignore){
- for(i = 0; i < ds_list_size(hitbox_ignoreList); i ++){
- if(hitbox_ignoreList[|i] == _inst){
- hitbox_ignore = true;
- break;
- }
- hitbox_ignore = false;
- }
- }
- //If we are not ignoring the hitbox, we proceed with the processing of the hitbox
- if(!hitbox_ignore)
- hitbox_apply(id, other.hitbox_owner, _inst);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement