instance_place_list

! NOTE: Don't forget to destroy the returned list when you are done with it, otherwise you'll have a memory leak.

Downloadinstance_place_list(x,y,obj)   Returns a ds_list of all instances of the given object colliding with the current instance at the given position.
/*
**  Usage:
**      instance_place_list(x,y,obj)
**
**  Arguments:
**      x,y         placement of current instance for collision check
**      obj         object to check for collision
**
**  Returns:
**      a ds_list id, or keyword noone if no instances are found
**
**  GMLscripts.com
*/

{
    var x1,y1,obj,dsid,this,that,i;
    x1 = argument0;
    y1 = argument1;
    obj = argument2;
    dsid = ds_list_create();
    this = id;
    with (obj) {
        that = id;
        with (this) {
            i = instance_place(x1,y1,that);
            if (i != noone) ds_list_add(dsid,i);
        }
    }
    if (ds_list_empty(dsid)) {
        ds_list_destroy(dsid);
        dsid = noone;
    }
    return dsid;
}

Click if you've used this script[Please Login]
Projects: 1


comments powered by Disqus