1.Quick Glance
Path Functions are used to get data on a path, utilize it or even render it under certain conditions or more. As of Version 1.12 path related functions are either on the GPE, GameObject or GPE_GamePath scopes.
2.Operating Paths
void GameObject.path_begin (DYNAMIC path, float pathSpeed, bool continueOnEnd, bool relativePath )
Creates a custom new path object to be used for pathfinding. Use the new object to add and remove points along its path.
Scope: GameObject
Return type : void
Parameters:
- DYNAMIC path -The id of the path or the GPE_GamePath object.
- float pathSpeed– The multiple to follow the path along with. Defaults to 1.
- bool continueOnEnd - If set to true the object will loop around and continue the path after reaching its final point. Defaults to true.
- bool relativePath - If set to true the object will make all of its points along the way relative to its position with the starting point(maintaining the same shape). If set to false, the object will begin moving towards the original points set within editor or engine. Defaults to false.
void GameObject.path_start(DYNAMIC path, float pathSpeed, bool continueOnEnd, bool relativePath )
Calls GameObject.path_begin( ... )
Scope: GameObject
Return type : void
Parameters:
- See GameObject.path_begin above
void GameObject.path_end ()
Ends the object path movement cycle in this game frame.
Scope: GameObject
Return type : void
Parameters: None
void GameObject.path_stop ()
Ends the object path movement cycle in this game frame. Same as GameObject.path_end().
Scope: GameObject
Return type : void
Parameters: None
bool GameObject.path_move_towards_point (int pointId )
Dynamically sets the object's next target point. If successful returns true, if not it returns false and stops the movement along its path.
Scope: GameObject
Return type : bool
Parameter:
- int pointId - The point to move to on the path(Value from 0 to pathSize).
bool GameObject.using_path()
Returns if the object is currently on a game path.
Scope: GameObject
Return type : bool
Parameters: None
3.Creating and editing paths
GPE_GamePath GPE.create_path (bool pIsClosed, bool addToList )
Creates a custom new path object to be used for path-finding. Use the new object to add and remove points along its path.
Scope: GPE
Return type : GPE_GamePath
Parameters:
- bool pIsClosed -True if the path will complete itself by connecting it two end-points.
- bool addToList - Select true if you will like for this local path to be added to the global list of paths in the game.
4.Path Getter Functions
int GameObject.get_path_id()
Returns the id of the path the object is on.
Scope: GameObject
Return type : int
Parameters: None
GPE_GamePath GameObject.get_path_object()
Returns if the object is currently on a game path. Returns IS_NULL if not on a recognized path.
Scope: GameObject
Return type : GPE_GamePath
Parameters: None
int GameObject.get_path_targetx()
Returns the target x-coordinate the object is moving towards on the current path.Defaults to 0 if not on a path.
Scope: GameObject
Return type : int
Parameters: None
int GameObject.get_path_targety()
Returns the target y-coordinate the object is moving towards on the current path. Defaults to 0 if not on a path.
Scope: GameObject
Return type : int
Parameters: None
int GameObject.get_path_size()
Returns the point number the object is moving towards on the current path. Defaults to -1 if not on a path.
Scope: GameObject
Return type : int
Parameters: None
int GameObject.get_path_original_size()
Returns the number of points within the path's ORIGINAL list of points. Defaults to -1 if not on a path.
Scope: GameObject
Return type : int
Parameters: None