singe/testScripts/author/qte.game
2026-09-14 14:20:17 -05:00

47 lines
1.8 KiB
Text

-- Genre two of the first slice: a quick-time event over video. No physics, no character, no
-- gravity -- the only layers are the disc and a flat overlay, and the rules talk about disc frames
-- and windows.
return {
title = "Author test: QTE over video",
layers = { { kind = "disc", file = "Singe/menuBackground.mkv", start = 180 }, { kind = "overlay" } },
vars = { score = 0 },
kinds = {
prompt = { look = { kind = "text", text = "", r = 255, g = 220, b = 80 } },
verdict = { look = { kind = "text", text = "", r = 160, g = 255, b = 180 } },
readout = { look = { kind = "text", text = "score 0", r = 235, g = 235, b = 245 } }
},
rooms = {
{ name = "scene",
entities = {
{ kind = "prompt", id = "prompt", x = 250, y = 60 },
{ kind = "verdict", id = "verdict", x = 250, y = 100 },
{ kind = "readout", id = "readout", x = 12, y = 12 }
} }
},
rules = {
{ note = "The window is open: ask for the button",
on = "frame",
when = { { "discBetween", from = 200, to = 260 } },
act = { { "setText", entity = "prompt", text = '"PRESS!"' } } },
{ note = "Answered in time, once",
on = "frame",
when = { { "discBetween", from = 200, to = 260 }, { "switchHeld", switch = "SWITCH_BUTTON1" }, { "once", tag = "hit" } },
act = { { "setVar", name = "hit", value = true },
{ "addScore", amount = 250 },
{ "setText", entity = "verdict", text = '"HIT"' } } },
{ note = "The window has closed without an answer",
on = "frameReached", frame = 260,
when = { { "test", expr = "not hit" } },
act = { { "setText", entity = "prompt", text = '""' },
{ "setText", entity = "verdict", text = '"MISS"' } } },
{ note = "The readout, every frame",
on = "frame",
act = { { "setText", entity = "readout", text = '"score " .. score' } } }
}
}