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

61 lines
2.5 KiB
Text

-- Genre two of milestone 1: a light gun game over video. Hitboxes keyed to disc frames, a gun
-- that hits or misses, ammo and a reload, a prompt at a frame, and the disc as the picture -- Mad
-- Dog McCree in a table. The boxes follow nothing in the menu video; they are where the test
-- expects them.
return {
title = "Author test: gun over video",
players = 1,
layers = { { kind = "disc", file = "Singe/menuBackground.mkv", start = 100 }, { kind = "overlay" } },
vars = { score = 0, misses = 0 },
kinds = {
gun = { look = { kind = "none" },
vars = { ammo = 3 },
behaviours = { { kind = "gun", player = 1, ammo = 3, reload = "offscreen" } } },
bandit = { look = { kind = "none" },
vars = { health = 1 },
behaviours = { { kind = "hitbox", track = "bandit" }, { kind = "health", max = 1 } } },
hostage = { look = { kind = "none" },
behaviours = { { kind = "hitbox", track = "hostage" } } },
readout = { look = { kind = "text", text = "", r = 235, g = 235, b = 245 } }
},
rooms = {
{ name = "street",
entities = {
{ kind = "gun", id = "gun1", x = 0, y = 0 },
{ kind = "bandit", id = "bandit", x = 0, y = 0 },
{ kind = "hostage", id = "hostage", x = 0, y = 0 },
{ kind = "readout", id = "readout", x = 12, y = 12 }
},
tracks = {
{ name = "bandit", key = "frame", boxes = { { at = 120, x = 100, y = 200, w = 60, h = 100 }, { at = 220, x = 400, y = 200, w = 60, h = 100 } } },
{ name = "hostage", key = "frame", boxes = { { at = 100, x = 560, y = 240, w = 50, h = 80 }, { at = 300, x = 560, y = 240, w = 50, h = 80 } } }
} }
},
rules = {
{ note = "The bandit is shot",
on = "hit", kind = "bandit",
act = { { "addScore", amount = 100 },
{ "damage", entity = "self", amount = 1 } } },
{ note = "The hostage is shot",
on = "hit", kind = "hostage",
act = { { "addScore", amount = -200 },
{ "flash", r = 255, g = 40, b = 40, seconds = 0.3 } } },
{ note = "A miss on the picture",
on = "miss",
when = { { "test", expr = "not event.offscreen" } },
act = { { "addVar", name = "misses", amount = 1 } } },
{ note = "Draw!",
on = "frameReached", frame = 120,
act = { { "say", text = '"DRAW!"', seconds = 1 } } },
{ note = "The readout, every frame",
on = "frame",
act = { { "setText", entity = "readout", text = '"score " .. score .. " ammo " .. gun1.ammo' } } }
}
}