ludic/phase-lateupdate.html
2026-09-17 22:10:03 +00:00

48 lines
No EOL
2.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LateUpdate — Ludic</title>
<meta name="description" content="Runs each frame after Update and before Render.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="api.html#phases">Phases</a> <span>›</span> <span class="here">LateUpdate</span></div>
<div class="item-head">
<span class="kind-badge kind-phase">phase</span>
<h1 id="top">LateUpdate</h1>
</div>
<code class="sig">phase LateUpdate</code>
<div class="desc"><p><code>LateUpdate</code> runs once per frame, after every <code>Update</code> handler has finished and just before <code>Render</code>. Use it for logic that must observe the <b>settled</b> result of this frame's updates: following the camera to the player's new position, resolving queued despawns, or any end-of-step cleanup that would be wrong to do while other <code>Update</code> handlers are still moving models. The full per-frame order the engine runs is <code>Input</code> → <code>FixedUpdate</code> → <code>Update</code> → <code>LateUpdate</code> → <code>Render</code>, with <code>Start</code> running once at boot before any of them.</p></div>
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program FollowCamera {
property Position { column: int = 0, row: int = 0 }
model Player { Position }
var camera_column: int = 0
handler SpawnPlayer phase Start {
spawn Player { Position { column: 12, row: 0 } }
}
@Queries(these: [Position])
handler MovePlayer phase Update {
Position.column = Position.column + 1
}
# runs after MovePlayer, so the camera sees the final position
@Queries(these: [Position])
handler TrackPlayer phase LateUpdate {
camera_column = Position.column
}
}</pre></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>