Collision line instance id's

Discussion in 'Programming' started by WoNkY, Sep 12, 2019.

Tags:
  1. WoNkY

    WoNkY Member

    Joined:
    Jan 20, 2019
    Posts:
    11
    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);
       }
    
    
     
  2. WoNkY

    WoNkY Member

    Joined:
    Jan 20, 2019
    Posts:
    11
    Fixed.
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,470
    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];
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice