draw_arrow(x1, y1, x2, y2, size);
参数 | 描述 |
---|---|
x1 | The x coordinate of the start of the line. |
y1 | The y coordinate of the start of the line. |
x2 | The x coordinate of the end of the line (where the arrowhead ends). |
y2 | The y coordinate of the end of the line (where the arrowhead ends). |
大小 | The length of the arrow in pixels. |
返回: N/A(无返回值)
This function will draw an arrow from point (x1,y1) to point (x2,y2). The stem of the arrow is drawn along these points with the actual arrow head being drawn at the end, where the size of the arrowhead is defined by the argument "size" and is calculated as being part of the stem so that the end point is always aligned with the position defined by x2,y2. The width of the arrow head is calculated automatically in proportion to the length.
draw_arrow(x, y, mouse_x, mouse_y, 10);
The above code will draw an arrow from the position of the instance to the position of the mouse, with the arrow head being 10 pixels long.