path_get_point_x

Returns the x coordinate of a given path's given defining point.

Syntax:

path_get_point_x(index, n);


Argument Description
index The index of the path to check.
n The point identity to check.


Returns: Real.


Description

This function will return the x position (in room coordinates) of the point that you input for the path that you index. If the point is outside of the range of the path (ie: a path has 8 points and you ask for the x position of point 10) then a value of 0 will be returned.


Example:

if path_position = 1
   {
   var i;
   i = floor(random(path_get_number(mypath)));
   x = path_get_point_x(mypath, i);
   y = path_get_point_y(mypath, i);
   path_position = (1 / path_get_number(mypath)) * i;
   }

The above code will check to see if an instance is at the end of a path. If it is it will then choose a random point on the path and move the instance to that point.


Back: Path Information
Next: path_get_point_y
© Copyright YoYo Games Ltd. 2018 All Rights Reserved