docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
47
phase-start.html
Normal file
47
phase-start.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Start — Ludic</title>
|
||||
<meta name="description" content="Runs once at boot, before the game loop — the place to set up initial state.">
|
||||
<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">Start</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-phase">phase</span>
|
||||
<h1 id="top">Start</h1>
|
||||
</div>
|
||||
<code class="sig">phase Start</code>
|
||||
<div class="desc"><p><code>Start</code> is the boot phase: a <code>handler … phase Start</code> runs <b>exactly once</b>, before the first frame and before the per-frame loop begins. Use it to build the world that everything else assumes — seed the RNG with <code>Random.seed</code>, set the tilemap size with <code>Map.size</code>, spawn the starting models, and initialise your program <code>var</code>s. It runs before any scene is entered, so it is the one phase a scene <code>layer</code> handler may <b>not</b> use; per-scene setup belongs in a scene's <code>on enter</code> block instead. Every other phase (<code>Input</code>, <code>FixedUpdate</code>, <code>Update</code>, <code>LateUpdate</code>, <code>Render</code>) then repeats each frame, but <code>Start</code> never runs again.</p></div>
|
||||
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program StartExample {
|
||||
property Position { column: int = 0, row: int = 0 }
|
||||
model Player { Position }
|
||||
|
||||
const GRID_WIDTH: int = 20
|
||||
var score: int = 0
|
||||
|
||||
handler SetUpWorld phase Start {
|
||||
Random.seed(value: 1)
|
||||
Map.size(width: GRID_WIDTH, height: 15)
|
||||
score = 0
|
||||
spawn Player { Position { column: 10, row: 7 } }
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_number(x: 4, y: 4, value: score, color: Color.Gold, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}</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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue