Start Following Path


Description

This action will start an instance following along a path that has been created in the resource tree. You would then use this action to tell your instance which path to follow, what speed to follow the path (measured in pixels per game frame), how to behave when it reaches the end of the path, and whether to follow the absolute or relative path position. When setting the speed you can use negative values to signify that the instance should follow the path in reverse and it's worth noting that the speed you set here can be modified by the speed modifier set in the path editor for each path point, so if you set a path speed to 2 and in the path one of the points has a speed modifier of 200% the actual pixels per game frame speed at that point will be 4.

Once you've set the initial path speed you can set how the instance should behave when it reaches the end of the path from the following options (note that when an instance reaches the end of a path this will also trigger an Other - Path Ended Event):

Finally, you can flag the path as being Relative or not. By default the instance will start to follows the path exactly as you designed and placed it in the Path Editor (the absolute position), but if you flag the Relative checkbox then it will start to follow the path from the position at which the instance was created (the relative position). The image below illustrates this:

Relative Vs. Absolute Paths

As you can see in this image, the two instances are following the same path started with this action, but one of the instances is following the absolute path while the other is following the relative path. It should be noted that when Relative is not flagged the instance will "jump" to the start of the path no matter where in the room it is placed.


Action Syntax:

Start Following Path Syntax


Arguments:

Argument Description
Path The path resource to start following
Speed The speed (in pixels per game frame) to follow the path
On End The response to reaching the end of the path


Example:

Start Following Path Example
The above action block code will start the calling instance following a path when a key is pressed.