Skip to content

Commit

Permalink
Merge pull request #100 from YoYoGames/develop.gurpreet
Browse files Browse the repository at this point in the history
[General] Mention that path position is updated post-Step
  • Loading branch information
gurpreetsinghmatharoo authored Feb 29, 2024
2 parents 7abf5ce + 2126e66 commit dbe93f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ <h1><span data-field="title" data-format="default">path_start</span></h1>
<p>A path is created from a series of defining points that are linked together and then used to plan the movements of an instance. They can be created with code, <i>or</i> in <a data-xref="{title}" href="../../../../The_Asset_Editors/Paths.htm">The Path Editor</a> and they are assigned to an instance to use in the game. You would then use this function to tell your instance which path to follow, what speed to follow the path (measured in pixels per step), how to behave when it reaches the end of the path, and whether to follow the <i>absolute</i> or <i>relative</i> path position. This last part means that it either starts and follows the path exactly as you designed and placed it in <a data-xref="{title}" href="../../../../The_Asset_Editors/Paths.htm">The Path Editor</a> (absolute), or it starts and follows the path from the position at which the instance was created (relative).</p>
<p><img alt="Relative or Absolute path examples" class="center" src="../../../../assets/Images/Scripting_Reference/GML/Reference/Paths/path_relative_image.png" />As you can see in the above image, the two instances are following the same path started with <span class="inline3_func"><span data-field="title" data-format="default">path_start</span></span>, but one of the instances is following the absolute path while the other is following the relative path. It should be noted that when <span class="inline2">absolute</span> is set to <span class="inline2">false</span> (i.e. relative) the instance will &quot;jump&quot; to the start of the path no matter where in the room it is placed.</p>
<p>The constants used to define the behaviour of the instance when it reaches the end of the path are given <a href="Path_Variables/path_endaction.htm">on this page</a>.</p>
<p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"> </span> When following a path, an instance&#39;s position is updated <a href="../../../../The_Asset_Editors/Object_Properties/Event_Order.htm">after the Step event</a>, so during the Step event its <a href="../Instances/Instance_Variables/x.htm">x</a> and <a href="../Instances/Instance_Variables/y.htm">y</a> position will be the same as its <a data-xref="{title}" href="../Instances/Instance_Variables/xprevious.htm">xprevious</a> and <a data-xref="{title}" href="../Instances/Instance_Variables/yprevious.htm">yprevious</a> (unless manually modified in the Begin Step or Step events).</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code"><span data-field="title" data-format="default">path_start</span>(path, speed, endaction, absolute);</p>
Expand All @@ -32,22 +33,22 @@ <h4>Syntax:</h4>
</tr>
<tr>
<td>path</td>
<td><span data-keyref="Type_Asset_Path"><a href="../../../../../The_Asset_Editors/Paths.htm" target="_blank">Path Asset</a></span></td>
<td><span data-keyref="Type_Asset_Path"><a href="../../../../The_Asset_Editors/Paths.htm" target="_blank">Path Asset</a></span></td>
<td>The path index to start.</td>
</tr>
<tr>
<td>speed</td>
<td><span data-keyref="Type_Real"><a href="../../../../../GameMaker_Language/GML_Overview/Data_Types.htm" target="_blank">Real</a></span></td>
<td><span data-keyref="Type_Real"><a href="../../../GML_Overview/Data_Types.htm" target="_blank">Real</a></span></td>
<td>The speed of which to follow the path in pixels per step, negative meaning going backwards.</td>
</tr>
<tr>
<td>endaction</td>
<td><span data-keyref="Type_Constant_Path_End_Action"><a href="../../../../../GameMaker_Language/GML_Reference/Asset_Management/Paths/Path_Variables/path_endaction.htm" target="_blank">Path End Action Constant</a></span></td>
<td><span data-keyref="Type_Constant_Path_End_Action"><a href="Path_Variables/path_endaction.htm" target="_blank">Path End Action Constant</a></span></td>
<td>What to do when the end of the path is reached.</td>
</tr>
<tr>
<td>absolute</td>
<td><span data-keyref="Type_Bool"><a href="../../../../../GameMaker_Language/GML_Overview/Data_Types.htm" target="_blank">Boolean</a></span></td>
<td><span data-keyref="Type_Bool"><a href="../../../GML_Overview/Data_Types.htm" target="_blank">Boolean</a></span></td>
<td>Whether the calling instance should follow the absolute path as it is defined in <a data-xref="{title}" href="../../../../The_Asset_Editors/Paths.htm">The Path Editor</a> (<span class="inline2">true</span>) or a relative path to its current position (<span class="inline2">false</span>).</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h2 id="every_step_frame">Every Step/Frame</h2>
</ul>
</li>
<li><strong>Alarms</strong></li>
<li><strong>Step Event</strong> (note that the Step event is executed just before instances are put in their new positions)</li>
<li><strong>Step Event</strong> (note that the Step event is executed just before instances are put in their new positions, including when following a path)</li>
<li><strong>End Step Event</strong></li>
</ul>
<p>After all Step events come all Draw events. These are also always dealt with in the same order as follows (except for the <strong>Window Resize </strong>event, which is triggered differently):</p>
Expand Down

0 comments on commit dbe93f7

Please sign in to comment.