JimPancakes
Member
The following code worked well when it was inside an instance but once I put it inside a script and called it from the same instance it does nothing.
Is there a reason why ds_list_add(_list, _check_here) wouldn't work when called from inside a script?
GML:
/// @function destroy_line(amount, first, last, direction, list);
function destroy_line(_amount, _first, _last, _list)
{
var _check_here = 0;
while _check_here != _amount
{
var _check_list = ds_list_create();
var _plank_nr = collision_line_list(_first.x, _first.y + (32 * _check_here), _last.x, _first.y + (32 * _check_here), all, false, true, _check_list, false);
var _plank_first = ds_list_find_value(_check_list, 0);
var _plank_sum = 1;
for (var i = 1; i < _plank_nr; ++i)
{
var _obj_id = _check_list[| i];
if object_get_name(_obj_id.object_index) = object_get_name(_plank_first.object_index)
{
_plank_sum += 1;
}
}
_check_here += 1;
if _plank_sum != 1 && _plank_sum = _plank_nr
{
ds_list_add(_list, _check_here);
}
ds_list_destroy(_check_list);
}
}