Board layers

This commit is contained in:
2026-06-15 23:35:18 -05:00
parent d1d0824d37
commit 01cd73ca3b
29 changed files with 2166 additions and 2051 deletions
+102 -120
View File
@@ -171,24 +171,10 @@ fn tick(dt) {
name = "Starting Room"
width = 60
height = 25
player_start = "@" # placed by the '@' grid char (convention)
[boards.start.palette]
" " = { archetype = "empty", tile = " ", fg = "#000000", bg = "#000000" }
"#" = { archetype = "wall", tile = "#", fg = "#808080", bg = "#606060" }
"+" = { archetype = "banana", tile = "#", fg = "#808080", bg = "#606060" }
"o" = { archetype = "crate", tile = 254, fg = "#aaaaaa", bg = "#000000" }
"-" = { archetype = "hcrate", tile = 29, fg = "#aaaaaa", bg = "#000000" }
"|" = { archetype = "vcrate", tile = 18, fg = "#aaaaaa", bg = "#000000" }
">" = { archetype = "pusher_east" }
"^" = { archetype = "pusher_north" }
# Optional visual floor layer, drawn under every empty cell (and revealed when a
# crate is pushed away). This is a grid form with its own palette: `g`/`d`/`s`
# name the built-in generators (random dark, low-saturation texture cached at
# load); a palette entry could also be a fixed glyph like
# `{ tile = ".", fg = "#222", bg = "#000" }`.
[boards.start.floor]
# Layer 0 (bottom): the visual floor. Generators g/d/s roll a fresh textured
# glyph per cell; the space char is a fixed water glyph.
[[boards.start.layers]]
content = """
gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
@@ -216,14 +202,15 @@ gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
"""
[boards.start.layers.palette]
"g" = { kind = "floor", generator = "grass" }
"d" = { kind = "floor", generator = "dirt" }
"s" = { kind = "floor", generator = "stone" }
" " = { kind = "floor", tile = "~", fg = "#6666ff", bg = "#000066" }
[boards.start.floor.palette]
"g" = "grass"
"d" = "dirt"
"s" = "stone"
" " = { tile = "~", fg = "#6666ff", bg = "#000066" }
[boards.start.grid]
# Layer 1: terrain, the player, objects and the portal. A space here is
# transparent (kind = "empty"), so the floor below shows through.
[[boards.start.layers]]
content = """
############################################################
# #
@@ -237,7 +224,7 @@ content = """
# # #
# | #
# #
# oo G - @ #
# V oo G - @ #
# #
# #
# #
@@ -251,69 +238,95 @@ content = """
# #
############################################################
"""
[boards.start.layers.palette]
" " = { kind = "empty" }
"#" = { kind = "wall", tile = "#", fg = "#808080", bg = "#606060" }
"+" = { kind = "banana", tile = "#", fg = "#808080", bg = "#606060" } # unknown kind -> ErrorBlock demo
"o" = { kind = "crate", tile = 254, fg = "#aaaaaa", bg = "#000000" }
"-" = { kind = "hcrate", tile = 29, fg = "#aaaaaa", bg = "#000000" }
"|" = { kind = "vcrate", tile = 18, fg = "#aaaaaa", bg = "#000000" }
">" = { kind = "pusher_east" }
"^" = { kind = "pusher_north" }
"@" = { kind = "player" }
"1" = { kind = "portal", name = "to_house", target_map = "house", target_entry = "from_start" }
"G" = { kind = "object", tile = "#", fg = "#aa3333", bg = "#000000", solid = false, script_name = "greeter" }
"V" = { kind = "object", tile = 1, fg = "#33aa33", bg = "#000000", script_name = "mover" }
"M" = { kind = "object", tile = 15, fg = "#ffdd88", bg = "#000000", solid = true, name = "muffin", script_name = "muffin" }
"B" = { kind = "object", tile = 240, fg = "#cc9944", bg = "#000000", solid = true, name = "noticeboard", script_name = "noticeboard" }
# Placed by its grid character `G` (uppercase-letter convention for objects)
# rather than x/y; the cell under it loads as Empty.
[[boards.start.objects]]
fg = "#aa3333"
bg = "#000000"
palette = "G"
tile = "#"
solid = false
script_name = "greeter"
# A solid object placed by x/y that paces east on its own. Demonstrates the
# rate-limited move(), the blocked() collision check, the Queue object, and the
# bump() hook (walk the player into it to trigger a bump).
[[boards.start.objects]]
x = 10
y = 12
fg = "#33aa33"
bg = "#000000"
tile = 1
script_name = "mover"
[[boards.start.objects]]
palette = "M"
tile = 15
fg = "#ffdd88"
bg = "#000000"
solid = true
name = "muffin"
script_name = "muffin"
# Notice board — long scroll to test overflow and scrolling.
[[boards.start.objects]]
palette = "B"
tile = 240
fg = "#cc9944"
bg = "#000000"
solid = true
name = "noticeboard"
script_name = "noticeboard"
[[boards.start.portals]]
name = "to_house"
palette = "1"
target_map = "house"
target_entry = "from_start"
# Layer 2: a purely decorative, non-solid object drawn *above* the solid crate
# beneath it — only possible because draw order follows layer order.
[[boards.start.layers]]
content = """
*
"""
[boards.start.layers.palette]
" " = { kind = "empty" }
"*" = { kind = "object", tile = 15, fg = "#ffff66", bg = "#000000", solid = false }
[boards.house.map]
name = "The House"
width = 60
height = 25
player_start = "@"
[boards.house.palette]
" " = { archetype = "empty", tile = " ", fg = "#000000", bg = "#000000" }
"#" = { archetype = "wall", tile = 178, fg = "#888888", bg = "#555555" }
# Layer 0: a single fixed floor glyph across the whole board.
[[boards.house.layers]]
content = """
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
"""
[boards.house.layers.palette]
"f" = { kind = "floor", tile = 176, fg = "#888888", bg = "#444444" }
[boards.house.floor]
tile = 176
fg = "#888888"
bg = "#444444"
[boards.house.grid]
# Layer 1: terrain, the player, objects and the return portal.
[[boards.house.layers]]
content = """
############################################################
# #
@@ -341,44 +354,13 @@ content = """
# #
############################################################
"""
[boards.house.layers.palette]
" " = { kind = "empty" }
"#" = { kind = "wall", tile = 178, fg = "#888888", bg = "#555555" }
"@" = { kind = "player" }
"1" = { kind = "portal", name = "from_start", target_map = "start", target_entry = "to_house" }
"K" = { kind = "object", tile = 240, fg = "#aa7733", bg = "#3d1c00", solid = true, name = "bookshelf", script_name = "bookshelf" }
"F" = { kind = "object", tile = 15, fg = "#ff8800", bg = "#220000", solid = true, name = "fireplace", script_name = "fireplace" }
"C" = { kind = "object", tile = 240, fg = "#ccaa44", bg = "#222200", solid = true, name = "chest", script_name = "chest" }
"T" = { kind = "object", tile = 1, fg = "#99ff44", bg = "#000000", solid = true, script_name = "yammerer" }
[[boards.house.objects]]
palette = "K"
tile = 240
fg = "#aa7733"
bg = "#3d1c00"
solid = true
name = "bookshelf"
script_name = "bookshelf"
[[boards.house.objects]]
palette = "F"
tile = 15
fg = "#ff8800"
bg = "#220000"
solid = true
name = "fireplace"
script_name = "fireplace"
[[boards.house.objects]]
palette = "C"
tile = 240
fg = "#ccaa44"
bg = "#222200"
solid = true
name = "chest"
script_name = "chest"
[[boards.house.objects]]
palette = "T"
tile = 1
fg = "#99ff44"
bg = "#000000"
solid = true
script_name = "yammerer"
[[boards.house.portals]]
name = "from_start"
palette = "1"
target_map = "start"
target_entry = "to_house"