draw_arrow

Draws an arrow, with a one pixel wide stem and the point defined by the user.

Syntax:

GML Code Example

draw_arrow(x1, y1, x2, y2, size);


Argument Description
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).
size The length of the arrow in pixels.


Returns: N/A


Description

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.


Example:

GML Code Example

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.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here