You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
<preclass="example">PRECONTROLPHASE <spanclass="comment">-- will be called immediately before OnControlPhase
147
+
<p>This is intended for module/library developers who want their modules to do
148
+
stuff during level start/load/end/save/control phase, but don't want the level
149
+
designer to add calls to <code>OnStart</code>, <code>OnLoad</code>, etc. in their level script.</p>
150
+
151
+
<p>Possible values for CallbackPoint:</p>
152
+
<preclass="example"><spanclass="comment">-- These take functions which accept no arguments
153
+
</span>PRESTART <spanclass="comment">-- will be called immediately before OnStart
154
+
</span>POSTSTART <spanclass="comment">-- will be called immediately after OnStart
155
+
</span>
156
+
PRESAVE <spanclass="comment">-- will be called immediately before OnSave
157
+
</span>POSTSAVE <spanclass="comment">-- will be called immediately after OnSave
158
+
</span>
159
+
PRELOAD <spanclass="comment">-- will be called immediately before OnLoad
160
+
</span>POSTLOAD <spanclass="comment">-- will be called immediately after OnLoad
161
+
</span>
162
+
<spanclass="comment">-- These take a LevelEndReason arg, like OnEnd
163
+
</span>PREEND <spanclass="comment">-- will be called immediately before OnEnd
164
+
</span>POSTEND <spanclass="comment">-- will be called immediately after OnEnd
165
+
</span>
166
+
<spanclass="comment">-- These take functions which accepts a deltaTime argument
167
+
</span>PRECONTROLPHASE <spanclass="comment">-- will be called immediately before OnControlPhase
146
168
</span>POSTCONTROLPHASE <spanclass="comment">-- will be called immediately after OnControlPhase
147
169
</span></pre>
148
170
<p>The order in which two functions with the same CallbackPoint are called is undefined.
149
-
i.e. if you register <code>MyFunc</code> and <code>MyFunc2</code> with <code>PRECONTROLPHASE</code>, both will be called before <code>OnControlPhase</code>, but there is no guarantee whether<code>MyFunc</code> will be called before <code>MyFunc2</code>, or vice-versa.</p>
171
+
i.e. if you register <code>MyFunc</code> and <code>MyFunc2</code> with <code>PRECONTROLPHASE</code>, both will be called before <code>OnControlPhase</code>, but there is no guarantee that<code>MyFunc</code> will be called before <code>MyFunc2</code>, or vice-versa.</p>
The function to be called (must be in the LevelFuncs hierarchy). Will receive, as an argument, the time in seconds since the last frame.
184
+
The function to be called (must be in the <ahref="../1 modules/Logic.html#LevelFuncs">LevelFuncs</a> hierarchy). Will receive, as an argument, the time in seconds since the last frame.
Will be called when leaving a level. This includes finishing it, exiting to the menu, or loading a save in a different level.
379
+
380
+
<p>(EndReason) Will be called when leaving a level. This includes finishing it, exiting to the menu, or loading a save in a different level. It can take an <code>EndReason</code> arg:</p>
381
+
382
+
<pre><code>EXITTOTITLE
383
+
LEVELCOMPLETE
384
+
LOADGAME
385
+
DEATH
386
+
OTHER
387
+
</code></pre>
388
+
389
+
<p>For example:</p>
390
+
<pre><code>LevelFuncs.OnEnd = function(reason)
391
+
if(reason == TEN.Logic.EndReason.DEATH) then
392
+
print("death")
393
+
end
394
+
end
395
+
</code></pre>
396
+
358
397
</li>
359
398
</ul>
360
399
@@ -370,7 +409,7 @@ <h3>Fields:</h3>
370
409
</div><!-- id="main" -->
371
410
<divid="about">
372
411
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
<i>generated by <ahref="https://github.com/hispidence/TEN-LDoc">TEN-LDoc</a> (a fork of <ahref="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a>)</i>
0 commit comments