singe/testScripts/author/qte.game
2026-09-13 22:06:39 -05:00

37 lines
1.6 KiB
Text

-- Genre two of two: 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", start = 180 },
{ kind = "overlay" }
},
entities = {
{ id = "prompt", x = 250, y = 60, look = { kind = "text", text = "", r = 255, g = 220, b = 80 } },
{ id = "verdict", x = 250, y = 100, look = { kind = "text", text = "", r = 160, g = 255, b = 180 } },
{ id = "readout", x = 12, y = 12, look = { kind = "text", text = "score 0", r = 235, g = 235, b = 245 } }
},
rules = {
{ note = "The window is open: ask for the button",
when = { { "discBetween", from = 200, to = 260 } },
act = { { "setText", entity = "prompt", text = '"PRESS!"' } } },
{ note = "Answered in time, once",
when = { { "discBetween", from = 200, to = 260 }, { "switchHeld", switch = "SWITCH_BUTTON1" }, { "once", tag = "hit" } },
act = { { "setFlag", flag = "hit", value = true },
{ "addScore", amount = 250 },
{ "setText", entity = "verdict", text = '"HIT"' } } },
{ note = "The window has closed without an answer",
when = { { "discBetween", from = 260, to = 320 }, { "once", tag = "judged" } },
act = { { "setText", entity = "prompt", text = '""' },
{ "lua", code = 'if not AUTHOR_FLAG["hit"] then authorSetText("verdict", "MISS") end' } } },
{ note = "The readout, every frame",
when = {},
act = { { "setText", entity = "readout", text = '"score " .. AUTHOR_SCORE' } } }
}
}