FeetUpGaming
Member
Hey so i'm making a rectangle select sort of thing for my game and i cannot get collision_rectangle_list to work.
and the on_current_layer script:
So the issue is that if i use the ds_list_size for the array then the on_current_layer script doesn't work at all. But if i use count the ds list id's are undefined. Here is the debug text:
Thanks for any help you can give
Code:
ds_list_clear(global.select_list);
var count = collision_rectangle_list(_x,_y,_ex,_ey,build_object,false,true,global.select_list,false);
show_debug_message("Col_Rect_List Found: "+string(count)+" Objects");
for(var i=0; i < count; i++;)
{
var _o = global.select_list[| i];
show_debug_message("i: "+string(i)+", Obj: "+string(_o))
if instance_exists(_o)
{
if !on_current_layer(_o)
{
ds_list_delete(global.select_list, i);
}
}
}
Code:
var _obj = argument[0].id;
if _obj.depth <= obj_builder.blayer[obj_builder.build_depth] && _obj.depth > obj_builder.blayer[obj_builder.build_depth]-5000
{
return true;
}
else
{
return false;
}
Code:
**********************************.
Entering main loop.
**********************************.
Col_Rect_List Found: 0 Objects
Col_Rect_List Found: 0 Objects
Col_Rect_List Found: 0 Objects
Col_Rect_List Found: 0 Objects
Col_Rect_List Found: 1 Objects
i: 0, Obj: 100236
Col_Rect_List Found: 2 Objects
i: 0, Obj: 100028
i: 1, Obj: 100236
Col_Rect_List Found: 4 Objects
i: 0, Obj: 100028
i: 1, Obj: 100236
i: 2, Obj: 100235
i: 3, Obj: undefined
ERROR!!! :: ############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_builder:
instance_exists argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Script_get_rect_select (line 25) - if instance_exists(_o)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_get_rect_select (line 25)
called from - gml_Object_obj_builder_Step_0 (line 294) - get_rect_select(rect_select_x,rect_select_y,mouse_x,mouse_y);