-- Genre one of milestone 5: branching full-motion video, Dragon's Lair in a table. Windows on -- the disc that want a move, the disc sent to a success or a failure clip, lives, credits and a -- continue, the arcade score panel, and the score sent to the board at the end. The menu video -- stands in for the disc. return { title = "Author test: branching video", layers = { { kind = "disc", file = "Singe/menuBackground.mkv", start = 100 }, { kind = "overlay" }, { kind = "bezel" } }, vars = { score = 0, lives = 3, credits = 0, taken = 0, missed = 0 }, types = { dirk = { look = { kind = "none" }, behaviours = { { kind = "branching", track = "moves" } } }, readout = { look = { kind = "text", text = "", r = 235, g = 235, b = 245 } }, prompt = { look = { kind = "text", text = "", r = 255, g = 220, b = 80 } } }, rooms = { { name = "cavern", entities = { { type = "dirk", id = "dirk", x = 0, y = 0 }, { type = "prompt", id = "prompt", x = 250, y = 60 }, { type = "readout", id = "readout", x = 12, y = 12 } }, tracks = { { name = "moves", key = "frame", branches = { { from = 120, to = 160, move = "RIGHT", success = 200, fail = 340 }, { from = 220, to = 260, move = "UP", success = 300, fail = 340 } } } } } }, rules = { { note = "A window opens: say what it wants", on = "branchOpen", act = { { "setText", entity = "prompt", text = '"MOVE " .. event.move' } } }, { note = "Made it", on = "branchTaken", act = { { "addScore", amount = 500 }, { "addVar", name = "taken", amount = 1 }, { "setText", entity = "prompt", text = '""' } } }, { note = "Missed it: a life gone", on = "branchMissed", act = { { "addVar", name = "lives", amount = -1 }, { "addVar", name = "missed", amount = 1 }, { "flash", r = 255, g = 40, b = 40, seconds = 0.3 }, { "setText", entity = "prompt", text = '""' } } }, { note = "The death clip is over: back to the cavern, or game over", on = "frameReached", frame = 380, when = { { "test", expr = "lives > 0" } }, act = { { "discTo", frame = 100 } } }, { note = "Out of lives", on = "frameReached", frame = 380, when = { { "test", expr = "lives <= 0" } }, act = { { "submitScore", board = "default" }, { "gameOver" } } }, { note = "A coin", on = "pressed", switch = "SWITCH_COIN1", act = { { "credit" } } }, { note = "Continue", on = "pressed", switch = "SWITCH_START1", when = { { "test", expr = "credits > 0 and lives <= 0" } }, act = { { "addVar", name = "credits", amount = -1 }, { "setVar", name = "lives", value = 3 }, { "restart" } } }, { note = "The readout, every frame", on = "frame", act = { { "setText", entity = "readout", text = '"score " .. score .. " lives " .. lives .. " credits " .. credits' } } } } }