singe/assets/Forge/tutorials/07-adventure.game
2026-09-14 22:32:53 -05:00

244 lines
5.2 KiB
Text

-- Written by Forge/AuthorCompile.singe. Edit by hand or in the editor; either is fine.
return {
dialogues = {
guard = {
nodes = {
ok = {
choices = {},
text = "Then go ahead.",
who = "Guard"
},
start = {
choices = {
{ next = "why", text = "Why not?" },
{ text = "Fine." }
},
text = "Nobody passes.",
who = "Guard"
},
why = {
choices = {
{
act = {
{ "setVar", name = "allowed", value = true }
},
next = "ok",
text = "I have a key.",
when = "has(\"key\")"
},
{ text = "I see." }
},
text = "The door is locked, and I have no key.",
who = "Guard"
}
},
start = "start"
}
},
types = {
backdrop = {
behaviours = {},
look = { file = "Forge/kit/yard.png", kind = "sprite" },
vars = {}
},
door = {
behaviours = {
{ kind = "hotspot", name = "door", walkX = 590, walkY = 330 }
},
look = { anchor = "feet", file = "Forge/kit/door.png", kind = "sprite" },
vars = {}
},
guard = {
behaviours = {
{ kind = "hotspot", name = "guard", walkX = 480, walkY = 360 }
},
look = { anchor = "feet", faces = "left", file = "Forge/kit/hero.png", frames = 8, kind = "sprite" },
vars = {}
},
hero = {
behaviours = {
{ kind = "walker", speed = 160 },
{ fps = 10, kind = "frames", states = "idle=1-1, walk=2-5" }
},
look = { anchor = "feet", file = "Forge/kit/hero.png", frames = 8, kind = "sprite" },
vars = {}
},
key = {
behaviours = {
{ kind = "hotspot", name = "key", walkX = 200, walkY = 400 }
},
look = { file = "Forge/kit/key.png", kind = "sprite" },
vars = {}
},
readout = {
look = { b = 245, g = 235, kind = "text", r = 235, text = "score 0" }
}
},
layers = {
{ kind = "overlay" }
},
rooms = {
{
depthSort = true,
entities = {
{ id = "readout", type = "readout", x = 12, y = 12 },
{ id = "backdrop", type = "backdrop", x = 360, y = 240 },
{ id = "hero", type = "hero", x = 150, y = 440 },
{ id = "door", type = "door", x = 590, y = 300 },
{ id = "key", type = "key", x = 200, y = 380 },
{ id = "guard", type = "guard", x = 520, y = 340 }
},
name = "yard",
scaleBy = {
{ scale = 0.6, y = 300 },
{ scale = 1.0, y = 460 }
},
tracks = {},
walk = {
{ 60, 320, 660, 320, 700, 460, 40, 460 }
}
},
{
depthSort = true,
entities = {
{ id = "backdrop", type = "backdrop", x = 360, y = 240 },
{ id = "readout", type = "readout", x = 12, y = 12 }
},
name = "hall",
tracks = {},
walk = {
{ 40, 300, 680, 300, 700, 460, 40, 460 }
}
}
},
rules = {
{
act = {
{ "setText", entity = "readout", text = "(sentence or \"\") .. \" score \" .. score" }
},
note = "The readout, every frame",
on = "frame"
},
{
act = {
{ "walkToPointer", entity = "hero", player = 1 }
},
interrupt = true,
note = "A click on the floor walks there",
on = "pressed",
switch = "SWITCH_BUTTON3",
when = {}
},
{
act = {
{ "say", seconds = 1, text = "\"It is a \" .. event.target .. \".\"" }
},
note = "Look at anything",
on = "verb",
verb = "look",
when = {}
},
{
act = {
{ "walkToHotspot", entity = "hero", target = "self" },
{ "give", item = "key" },
{ "addScore", amount = 1 },
{ "destroy", entity = "self" }
},
note = "Take the key",
on = "verb",
target = "key",
verb = "take",
when = {}
},
{
act = {
{ "walkToHotspot", entity = "hero", target = "self" },
{ "face", entity = "hero", target = "self" },
{ "talk", dialogue = "guard" }
},
note = "Talk to the guard",
on = "verb",
target = "guard",
verb = "talk",
when = {}
},
{
act = {
{ "say", seconds = 1, text = "\"The guard shakes his head.\"" }
},
note = "The door, while the guard objects",
on = "verb",
target = "door",
verb = "open",
when = {
{ "test", expr = "not allowed" }
}
},
{
act = {
{ "walkToHotspot", entity = "hero", target = "self" },
{ "playSound", file = "Forge/kit/door.wav" },
{ "fade", out = true, seconds = 0.5 },
{ "goTo", entity = "hero", room = "hall", x = 120, y = 420 },
{ "fade", out = false, seconds = 0.5 },
{ "addScore", amount = 1 }
},
controls = false,
note = "The door opens",
on = "verb",
target = "door",
verb = "open",
when = {
{ "test", expr = "allowed" }
}
},
{
act = {
{ "say", seconds = 1, text = "\"That does not work.\"" }
},
note = "Anything else",
on = "verb",
when = {}
},
{
act = {
{ "setVerb", verb = "look" }
},
key = "L",
note = "The verb keys",
on = "pressed",
when = {}
},
{
act = {
{ "setVerb", verb = "take" }
},
key = "T",
note = "Take",
on = "pressed",
when = {}
},
{
act = {
{ "setVerb", verb = "open" }
},
key = "O",
note = "Open",
on = "pressed",
when = {}
},
{
act = {
{ "setVerb", verb = "talk" }
},
key = "K",
note = "Talk",
on = "pressed",
when = {}
}
},
title = "The Yard",
vars = { allowed = false, score = 0 },
verbs = { "walk", "look", "take", "use", "open", "talk" }
}