Collision line instance id's

W

WoNkY

Guest
Using collision_line_list for first time for a laser beam, only need the closest instance id.

This always returns -4, as the instance Id, whatever the mouse is over. Probably an elementary mistake, help welcome.

Code:
var list = ds_list_create();
var num = collision_line_list(x, y, mouse_x, mouse_y, all, false, true, list, true);
if  num > 0
         var temp_id = instance_id_get(list[| 0]) ;                    
         ds_list_destroy(list);
   }
 

FrostyCat

Member
The list is already filled with actual instance IDs, not positions in the instance_id[] array. Don't use instance_id_get() on it.
Code:
var temp_id = list[| 0];
 
Top