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

140 lines
3.1 KiB
Text

-- Written by Forge/AuthorCompile.singe. Edit by hand or in the editor; either is fine.
return {
types = {
prompt = {
behaviours = {},
look = { b = 80, g = 220, kind = "text", r = 255 },
vars = {}
},
readout = {
look = { b = 245, g = 235, kind = "text", r = 235, text = "score 0" }
},
verdict = {
behaviours = {},
look = { b = 180, g = 255, kind = "text", r = 160 },
vars = {}
}
},
layers = {
{ file = "Forge/kit/clip.mkv", kind = "disc" },
{ kind = "overlay" }
},
rooms = {
{
entities = {
{ id = "readout", type = "readout", x = 12, y = 12 },
{ id = "prompt", type = "prompt", x = 250, y = 60 },
{ id = "verdict", type = "verdict", x = 250, y = 100 }
},
name = "start",
tracks = {}
}
},
rules = {
{
act = {
{ "setText", entity = "readout", text = "\"score \" .. score .. \" lives \" .. lives" }
},
note = "The readout, every frame",
on = "frame"
},
{
act = {
{ "setText", entity = "prompt", text = "\"PRESS!\"" }
},
note = "Window one is open",
on = "frame",
when = {
{ "discBetween", from = 72, to = 120 }
}
},
{
act = {
{ "setVar", name = "hitone", value = true },
{ "addScore", amount = 250 },
{ "setText", entity = "verdict", text = "\"HIT\"" }
},
note = "Window one answered in time",
on = "frame",
when = {
{ "discBetween", from = 72, to = 120 },
{ "keyPressed", key = "SPACE" },
{ "once", tag = "one" }
}
},
{
act = {
{ "addVar", amount = -1, name = "lives" },
{ "setText", entity = "verdict", text = "\"MISS\"" },
{ "setText", entity = "prompt", text = "\"\"" }
},
frame = 120,
note = "Window one closed unanswered",
on = "frameReached",
when = {
{ "test", expr = "not hitone" }
}
},
{
act = {
{ "setText", entity = "prompt", text = "\"UP!\"" }
},
note = "Window two is open",
on = "frame",
when = {
{ "discBetween", from = 150, to = 200 }
}
},
{
act = {
{ "setVar", name = "hittwo", value = true },
{ "addScore", amount = 250 },
{ "setText", entity = "verdict", text = "\"HIT\"" }
},
note = "Window two answered in time",
on = "frame",
when = {
{ "discBetween", from = 150, to = 200 },
{ "keyPressed", key = "UP" },
{ "once", tag = "two" }
}
},
{
act = {
{ "addVar", amount = -1, name = "lives" },
{ "setText", entity = "verdict", text = "\"MISS\"" },
{ "setText", entity = "prompt", text = "\"\"" }
},
frame = 200,
note = "Window two closed unanswered",
on = "frameReached",
when = {
{ "test", expr = "not hittwo" }
}
},
{
act = {
{ "setVar", name = "hitone", value = false },
{ "setVar", name = "hittwo", value = false },
{ "setText", entity = "verdict", text = "\"\"" },
{ "discTo", frame = 1 }
},
frame = 280,
note = "The clip runs out: round again",
on = "frameReached",
when = {}
},
{
act = {
{ "gameOver" }
},
note = "Out of lives",
on = "frame",
when = {
{ "test", expr = "lives <= 0" }
}
}
},
title = "Moments",
vars = { lives = 3, score = 0 }
}