path_delete

Deletes a given path.

Syntax:

path_delete(index);


Argument Description
index The index of the path to delete.


Returns: N/A


Description

You can use this code to remove a path from memory. If this path has been created dynamically using path_add, the variable that holds the path index will no longer be valid for accessing the path as it no longer exists, and if the path was created using the Path Editor that path can no longer be accessed in the whole game as you are permanently deleting it.

IMPORTANT! This function is not available with the Trial Licence of the product.



Example:

var t_path;
t_path = path_add();
if mp_grid_path(grid, t_path, x, y, obj_Player.x, obj_Player.y, 1)
   {
   path_assign(mypath, t_path);
   }
path_delete(t_path);

The above code will create a path and store its index in a local variable. This path is then used to store an mp_grid_path generated path which, if it succeeds in finding its way to the target, it is then assigned to the path indexed in "mypath". Finally the "t_path" is deleted.


Back: Changing Paths
Next: path_duplicate
© Copyright YoYo Games Ltd. 2018 All Rights Reserved