GML Functions: Paths

In Game Maker you can define paths and order instances to follow such paths. Although you can use actions for this, there are functions and variables that give you more flexibility:


 * path_start(path,speed,endaction,absolute) Starts a path for the current instance. The path is the name of the path you want to start. The speed is the speed with which the path must be followed. A negative speed means that the instance moves backwards along the path. The endaction indicates what should happen when the end of the path is reached. The following values can be used:


 * 0 : stop the path
 * 1: continue from the start position (if the path is not closed we jump to the start position
 * 2: continue from the current position
 * 3: reverse the path, that is change the sign of the speed

The argument absolute should be true or false. When true the absolute coordinates of the path are used. When false the path is relative to the current position of the instance. To be more precise, if the speed is positive, the start point of the path will be placed on the current position and the path is followed from there. When the speed is negative the end point of the path will be placed on the current position and the path is followed backwards from there.
 * path_end Ends the following of a path for the current instance.
 * path_index* Index of the current path the instance follows. You cannot change this directly but must use the function above.
 * path_position Position in the current path. 0 is the beginning of the path. 1 is the end of the path. The value must lie between 0 and 1.
 * path_positionprevious Previous position in the current path. This can be used e.g. in collision events to set the position on the path back to the previous position.
 * path_speed Speed (in pixels per step) with which the path must be followed. Use a negative speed to move backwards.
 * path_orientation Orientation (counter-clockwise) into which the path is performed. 0 is the normal orientation of the path.
 * path_scale Scale of the path. Increase to make the path larger. 1 is the default value.
 * path_endaction The action that must be performed at the end of the path. You can use the values indicated above.