draw_path

Draws a path resource.

Syntax:

GML Code Example

draw_path(path, x, y, absolute);


Argument Description
path The path to draw
x The x coordinate of where the path is drawn
y The y coordinate of where the path is drawn
absolute Whether the path is drawn at the absolute position (true) or the relative position (false)


Returns: N/A


Description

With this function you can get GameMaker: Studio to draw a path to the screen. The path will be drawn as a simple line, and can be either relative to the calling instance or at the absolute position it was created at in the path editor or through code. This function is extremely useful when debugging dynamic paths (for example, those created for instances with the mp_grid_path function).


Example:

GML Code Example

if mp_grid_path(grid, path, x, y, obj_Player.x, obj_Player.y, 1)
    {
    draw_path(path, x, y, false);
    }
 

the above code will use the mp_grid_path function to generate a path and store it in the variable "path". If the path is successfully created, it is then drawn on the screen at a position relative to the instance running the code.





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