docs: regenerate site from f094acfdb5

This commit is contained in:
ludic-docs-bot 2026-09-17 22:10:03 +00:00
commit 63c5ed9baf
975 changed files with 55427 additions and 0 deletions

64
map-tile.html Normal file
View file

@ -0,0 +1,64 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Map.tile — Ludic</title>
<meta name="description" content="Read the tile character at a cell (out-of-bounds reads answer &#x27;#&#x27;).">
<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="ns-map.html">Map — tilemap</a> <span>›</span> <span class="here">Map.tile</span></div>
<div class="item-head">
<span class="kind-badge kind-method">method</span>
<h1 id="top">Map.tile</h1>
</div>
<code class="sig">Map.tile(x, y) -&gt; int</code>
<div class="desc"><p>Reads the tile character at cell <code>(x, y)</code> and returns it as a character code, so you can compare it against literals like <code>'#'</code> or <code>'.'</code>. Use it for collision checks (is the cell ahead a wall?), rendering the map, or querying your own custom tile codes. Cells outside the map you set with <code>Map.size</code> answer <code>'#'</code>, so the border of the world acts as a wall automatically and you never need special edge-of-map handling. Coordinates are cell indices, not pixels.</p></div>
<div class="params"><h2>Parameters</h2><div class="param" id="param-x"><code class="pname">x</code><span class="pdesc">the cell column to read (<code>0</code>-based)</span></div><div class="param" id="param-y"><code class="pname">y</code><span class="pdesc">the cell row to read (<code>0</code>-based)</span></div></div>
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program WallCollision {
property Position { column: int = 0, row: int = 0 }
model Player { Position }
const TILE_SIZE: int = 16
handler BuildLevel phase Start {
Map.size(width: 8, height: 4)
Map.row(y: 0, cells: "########")
Map.row(y: 1, cells: "#..##..#")
Map.row(y: 2, cells: "#......#")
Map.row(y: 3, cells: "########")
spawn Player { Position { column: 1, row: 2 } }
}
handler MovePlayer phase Update {
for (Position) in query [Position, {Player}] {
let next_column = Position.column + 1
if Map.tile(x: next_column, y: Position.row) != '#' {
Position.column = next_column
}
}
}
handler DrawWorld phase Render {
Screen.clear(Color.MidnightBlue)
for (Position) in query [Position, {Player}] {
Screen.fill_rectangle(
x: Position.column * TILE_SIZE,
y: Position.row * TILE_SIZE,
width: TILE_SIZE,
height: TILE_SIZE,
color: Color.LimeGreen)
}
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>