Paths

Game Maker 8

Paths

It is possible to create paths and to add points to paths. However, never change a path that is being used by an instance. This can lead to unexpected results. The following functions exist:

path_set_kind(ind,val) Sets the kind of connections of the path with the given index (0=straight, 1=smooth).
path_set_closed(ind,closed) Sets whether the path must be closed (true) or open (false).
path_set_precision(ind,prec) Sets the precision with which the smooth path is calculated (should lie between 1 and 8).
path_add() Adds a new empty paths. The index of the path is returned.
path_delete(ind) Deletes the path with the given index.
path_duplicate(ind) Creates a duplicate copy of the path with the given index. Returns the index of the copy.
path_assign(ind,path) Assigns the indicated path to path ind. So this makes a copy of the path. In this way you can easily set an existing path to a different, e.g. new path.
path_append(ind,path) Appends the indicated path to path ind.
path_add_point(ind,x,y,speed) Adds a point to the path with the given index, at position (x,y) and with the given speed factor. Remember that a factor of 100 corresponds to the actual speed. Lower values mean slowing down and higher mean speeding up.
path_insert_point(ind,n,x,y,speed) Inserts a point in the path with the given index before point n, at position (x,y) and with the given speed factor.
path_change_point(ind,n,x,y,speed) Changes the point n in the path with the given index to position (x,y) and the given speed factor.
path_delete_point(ind,n) Deletes the point n in the path with the given index.
path_clear_points(ind) Clears all the points in the path, turning it into an empty path.
path_reverse(ind) Reverses the path.
path_mirror(ind) Mirrors the path horizontally (with respect to its center).
path_flip(ind) Flips the path vertically (with respect to its center).
path_rotate(ind,angle) Rotates the path counter clockwise over angle degrees (around its center).
path_scale(ind,xscale,yscale) Scales the path with the given factors (from its center).
path_shift(ind,xshift,yshift) Shifts the path over the given amount.