path_add

Adds an empty path and returns its index.

Syntax:

path_add();


Returns: Real.


Description

With this function you can create a path in GameMaker: Studio without using the path editor. this function will return the index of the path which should be stored in a variable and used as the reference for that path from then on. Please note that the created path is empty ie: it has no points defined, so you will then have to use the other available functions to add points to the path or be using mp_grids to generate the path. Once you have finished using the path, or wish to create a new one and store its index in the same variable you should first delete the old path with path_delete to prevent memory leaks which can eventually crash your game.


Example:

global.newpath = path_add();

This will create a new path and assign its index to global.newpath.


Back: Changing Paths
Next: path_add_point
© Copyright YoYo Games Ltd. 2015 All Rights Reserved