docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
58
map-row.html
Normal file
58
map-row.html
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Map.row — Ludic</title>
|
||||
<meta name="description" content="Fill one row of the tilemap from a string of tile characters.">
|
||||
<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.row</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-method">method</span>
|
||||
<h1 id="top">Map.row</h1>
|
||||
</div>
|
||||
<code class="sig">Map.row(y, cells)</code>
|
||||
<div class="desc"><p>Fills a single map row from a string, one character per cell — an easy, readable way to author a level directly in source. Character <code>y</code> selects the row (from the top, starting at <code>0</code>), and each character of <code>cells</code> becomes the tile at that column. Call <code>Map.size</code> first, then one <code>Map.row</code> per row; the string length should match the map width. By convention <code>'#'</code> is a wall and <code>'.'</code> is open floor, but you may use any characters as your own tile codes and interpret them however you like with <code>Map.tile</code>.</p></div>
|
||||
<div class="params"><h2>Parameters</h2><div class="param" id="param-y"><code class="pname">y</code><span class="pdesc">the row index to fill, from the top (<code>0</code>-based)</span></div><div class="param" id="param-cells"><code class="pname">cells</code><span class="pdesc">a string of tile characters, one per column</span></div></div>
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program HandDrawnLevel {
|
||||
const GRID_WIDTH: int = 10
|
||||
const GRID_HEIGHT: int = 5
|
||||
const TILE_SIZE: int = 16
|
||||
|
||||
handler BuildLevel phase Start {
|
||||
Map.size(width: GRID_WIDTH, height: GRID_HEIGHT)
|
||||
Map.row(y: 0, cells: "##########")
|
||||
Map.row(y: 1, cells: "#........#")
|
||||
Map.row(y: 2, cells: "#..####..#")
|
||||
Map.row(y: 3, cells: "#........#")
|
||||
Map.row(y: 4, cells: "##########")
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
for row in 0 .. GRID_HEIGHT {
|
||||
for column in 0 .. GRID_WIDTH {
|
||||
if Map.tile(x: column, y: row) == '#' {
|
||||
Screen.fill_rectangle(
|
||||
x: column * TILE_SIZE,
|
||||
y: row * TILE_SIZE,
|
||||
width: TILE_SIZE,
|
||||
height: TILE_SIZE,
|
||||
color: Color.White)
|
||||
}
|
||||
}
|
||||
}
|
||||
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