1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GML How i can create a pointer for a gun?

Discussion in 'Programming' started by Sergi Canaleta, May 14, 2019 at 12:54 PM.

  1. Sergi Canaleta

    Sergi Canaleta Member

    Joined:
    Tuesday
    Posts:
    2
    if i use a draw_rectangle(x,y,mouse_x,mouse_y,20);

    it creates me a rectangle but not do a good pointer

    so if i want to create a laser pointer and can collide with every object that is visible how i can do it?
     
  2. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,253
    You might be looking for draw_line and collision_line.
     
  3. Sergi Canaleta

    Sergi Canaleta Member

    Joined:
    Tuesday
    Posts:
    2
    but how i can resize the line?
     
  4. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,253
    For drawing, you have draw_line_width.
    For collision, you could use multiple collision_lines in a loop, one for each pixel, or use a rectangular, rotated, precise collision mask scaled to or created at the desired length and width. There may be other methods.
     

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