new layer model
This commit is contained in:
+29
-55
@@ -180,50 +180,28 @@ fn tick(me, dt) {
|
||||
}
|
||||
"""
|
||||
|
||||
# A trigger script: no glyph, not solid — it just watches for the player stepping
|
||||
# onto its cell and logs. Triggers are placed via [[boards.NAME.triggers]].
|
||||
tripwire = """
|
||||
fn tick(me, dt) {
|
||||
if Player.x == me.x && Player.y == me.y && !me.waiting {
|
||||
log("tripwire: the player crossed here");
|
||||
me.delay(2.0);
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
[boards.start.map]
|
||||
name = "Starting Room"
|
||||
width = 60
|
||||
height = 25
|
||||
# A single procedural grass floor across the whole board (the old mixed
|
||||
# grass/dirt/stone/water floor is not representable with one floor attribute).
|
||||
floor = { generator = "grass" }
|
||||
|
||||
# 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
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
ggggggwwwwwwgggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
ggggggwwwwwwgggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
ggggggwwwwwwgggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
ggggggwwwwwwgggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
gggggggggggggggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
gggggggggggggggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
gggggggggggggggggggggggggsggggdddddddddddddddddddddggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggsgggggggggggggggggggggggggggggggggg
|
||||
gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
|
||||
"""
|
||||
[boards.start.layers.palette]
|
||||
"g" = { kind = "floor", generator = "grass" }
|
||||
"d" = { kind = "floor", generator = "dirt" }
|
||||
"s" = { kind = "floor", generator = "stone" }
|
||||
"w" = { kind = "floor", tile = "~", fg = "#6666ff", bg = "#000066" }
|
||||
|
||||
# Layer 1: terrain, the player, objects and the portal. A space is always a
|
||||
# transparent empty cell, so the floor below shows through.
|
||||
[[boards.start.layers]]
|
||||
# The single grid: all solids and most non-solids (terrain, the player, objects and
|
||||
# the portal). A space is always a transparent empty cell, so the floor shows through.
|
||||
[boards.start.grid]
|
||||
content = """
|
||||
############################################################
|
||||
# #
|
||||
@@ -251,7 +229,7 @@ content = """
|
||||
# #
|
||||
############################################################
|
||||
"""
|
||||
[boards.start.layers.palette]
|
||||
[boards.start.grid.palette]
|
||||
"#" = { 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" }
|
||||
@@ -272,26 +250,22 @@ content = """
|
||||
")" = { kind = "transporter_east" }
|
||||
"(" = { kind = "transporter_west" }
|
||||
|
||||
# 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]]
|
||||
sparse = [{ x = 30, y = 12, ch = "*" }]
|
||||
[boards.start.layers.palette]
|
||||
"*" = { kind = "object", tile = 15, fg = "#ffff66", bg = "#000000", solid = false }
|
||||
# Triggers: invisible, non-solid, script-only objects placed off the grid. This one
|
||||
# watches for the player and logs when they reach its cell.
|
||||
[[boards.start.triggers]]
|
||||
x = 40
|
||||
y = 12
|
||||
script_name = "tripwire"
|
||||
|
||||
[boards.house.map]
|
||||
name = "The House"
|
||||
width = 60
|
||||
height = 25
|
||||
# A single fixed floor glyph across the whole board.
|
||||
floor = { tile = 176, fg = "#888888", bg = "#444444" }
|
||||
|
||||
# Layer 0: a single fixed floor glyph across the whole board.
|
||||
[[boards.house.layers]]
|
||||
fill = "f"
|
||||
[boards.house.layers.palette]
|
||||
"f" = { kind = "floor", tile = 176, fg = "#888888", bg = "#444444" }
|
||||
|
||||
# Layer 1: terrain, the player, objects and the return portal.
|
||||
[[boards.house.layers]]
|
||||
# The single grid: terrain, the player, objects and the return portal.
|
||||
[boards.house.grid]
|
||||
content = """
|
||||
############################################################
|
||||
# #
|
||||
@@ -319,7 +293,7 @@ content = """
|
||||
# #
|
||||
############################################################
|
||||
"""
|
||||
[boards.house.layers.palette]
|
||||
[boards.house.grid.palette]
|
||||
"#" = { kind = "wall", tile = 178, fg = "#888888", bg = "#555555" }
|
||||
"@" = { kind = "player" }
|
||||
"1" = { kind = "portal", name = "from_start", target_map = "start", target_entry = "to_house" }
|
||||
|
||||
+10
-9
@@ -6,15 +6,15 @@ start = "start"
|
||||
# Objects reference a script by name via `script_name`.
|
||||
[scripts]
|
||||
greeter = """
|
||||
fn init(me, state) {
|
||||
log(`hello from object — player at ${state.player.x}, ${state.player.y}`);
|
||||
fn init(me) {
|
||||
log(`hello from object — player at ${Player.x}, ${Player.y}`);
|
||||
set_tile(2); // change my glyph to ☻ — proves the write path
|
||||
//say("Hello there,\\ntraveller!");
|
||||
log(`Player health: ${state.player.health}`);
|
||||
log(`Player health: ${Player.health}`);
|
||||
}
|
||||
|
||||
fn tick(me, state, dt) {
|
||||
if state.player.x == me.x && state.player.y == me.y && !me.waiting {
|
||||
fn tick(me, dt) {
|
||||
if Player.x == me.x && Player.y == me.y && !me.waiting {
|
||||
say("Hey! Get offa me!");
|
||||
me.queue.delay(5.0);
|
||||
}
|
||||
@@ -25,10 +25,11 @@ fn tick(me, state, dt) {
|
||||
name = "Starting Room"
|
||||
width = 21
|
||||
height = 6
|
||||
# No floor attribute → a blank (black) floor.
|
||||
|
||||
# Layer 1: terrain, the player, objects and the portal. A space is always a
|
||||
# transparent empty cell, so the floor below shows through.
|
||||
[[boards.start.layers]]
|
||||
# The single grid: all solids and most non-solids. A space is always a transparent
|
||||
# empty cell, so the floor shows through.
|
||||
[boards.start.grid]
|
||||
content = """
|
||||
#####################
|
||||
# #
|
||||
@@ -37,7 +38,7 @@ content = """
|
||||
# #
|
||||
#####################
|
||||
"""
|
||||
[boards.start.layers.palette]
|
||||
[boards.start.grid.palette]
|
||||
"#" = { kind = "wall", tile = "#", fg = "#808080", bg = "#606060" }
|
||||
"o" = { kind = "crate", tile = 254, fg = "#aaaaaa", bg = "#000000" }
|
||||
"@" = { kind = "player" }
|
||||
|
||||
Reference in New Issue
Block a user