path_delete(index);
参数 | 描述 |
---|---|
index | The index of the path to delete. |
返回: N/A(无返回值)
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.
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.