-- Genre one of milestone 2: a rail shooter, House of the Dead in a table. A camera on a rail -- that stops at encounters, zombies (the Fox, standing in) that spawn at each stop, walk to the -- camera, and bite on a timer unless they are killed, a gun that hits what the pointer is over -- -- and which part -- ragdolls, and a level end. return { title = "Author test: rail shooter", players = 1, size = { w = 720, h = 480 }, layers = { { kind = "scene3d", ambient = { r = 70, g = 70, b = 90 }, fog = { r = 12, g = 12, b = 22, near = 25, far = 60 }, fov = 60 }, { kind = "overlay" } }, vars = { score = 0, misses = 0, health = 3, bites = 0, stops = 0 }, kinds = { floor = { look = { kind = "mesh", shape = "box", w = 40, h = 0.2, d = 100, r = 70, g = 75, b = 90 }, behaviours = { { kind = "solid" } } }, wall = { look = { kind = "mesh", shape = "box", w = 1, h = 3, d = 12, r = 120, g = 60, b = 60 }, behaviours = { { kind = "solid" } } }, camera = { look = { kind = "none" }, behaviours = { { kind = "camera", mode = "rail", track = "rail" } } }, gun = { look = { kind = "none" }, vars = { ammo = 6 }, behaviours = { { kind = "gun", player = 1, ammo = 6, reload = "offscreen" } } }, zombie = { look = { kind = "model", file = "testScripts/Models/Fox.glb", scale = 0.01, w = 0.8, h = 0.9, d = 1.4 }, vars = { health = 2 }, behaviours = { { kind = "health", max = 2, ragdoll = true, linger = 2 }, { kind = "seek", target = "camera", speed = 1.6, stopAt = 2.2 }, { kind = "animator", idle = "Survey", walk = "Walk", attack = "Run", fade = 0.2 }, { kind = "target", zones = { { name = "head", bone = "b_Head_05", w = 0.5, h = 0.5, d = 0.5 } } }, { kind = "timer", name = "bite", after = 1.5, start = false } } }, readout = { look = { kind = "text", text = "", r = 235, g = 235, b = 245 } } }, rooms = { { name = "street", entities = { { kind = "floor", id = "floor", x = 0, y = -0.1, z = -30 }, { kind = "wall", id = "wallL", x = -6, y = 1.5, z = -12 }, { kind = "wall", id = "wallR", x = 6, y = 1.5, z = -12 }, { kind = "camera", id = "camera", x = 0, y = 1.6, z = 0 }, { kind = "gun", id = "gun1", x = 0, y = 0, z = 0 }, { kind = "readout", id = "readout", x = 12, y = 12, z = 0 } }, tracks = { { name = "rail", key = "time", points = { { at = 0, x = 0, y = 1.6, z = 0, look = { 0, 1.2, -10 } }, { at = 4, x = 0, y = 1.6, z = -6, look = { 0, 1.2, -16 }, stop = "hall" }, { at = 10, x = 2, y = 1.6, z = -16, look = { 2, 1.2, -26 }, stop = "yard" }, { at = 14, x = 2, y = 1.6, z = -22, look = { 2, 1.2, -32 } } } } } } }, rules = { { note = "The hall: three come out of the dark", on = "stopped", name = "hall", act = { { "addVar", name = "stops", amount = 1 }, { "spawn", kind = "zombie", x = -2, y = 0, z = -14 }, { "spawn", kind = "zombie", x = 2, y = 0, z = -15 }, { "spawn", kind = "zombie", x = 0, y = 0, z = -17 } } }, { note = "The yard: four more", on = "stopped", name = "yard", act = { { "addVar", name = "stops", amount = 1 }, { "spawn", kind = "zombie", x = -1, y = 0, z = -24 }, { "spawn", kind = "zombie", x = 4, y = 0, z = -25 }, { "spawn", kind = "zombie", x = 2, y = 0, z = -27 }, { "spawn", kind = "zombie", x = 0, y = 0, z = -28 } } }, { note = "A zombie starts walking the moment it is made", on = "spawn", kind = "zombie", act = { { "setState", entity = "self", state = "walk" } } }, { note = "A shot lands", on = "hit", kind = "zombie", act = { { "damage", entity = "self", amount = 1 }, { "addScore", amount = 100 } } }, { note = "A headshot lands harder", on = "hit", kind = "zombie", when = { { "hitPart", part = "head" } }, act = { { "damage", entity = "self", amount = 2 }, { "addScore", amount = 300 } } }, { note = "It reaches the camera and rears up", on = "arrived", kind = "zombie", act = { { "setState", entity = "self", state = "attack" }, { "timerStart", entity = "self", name = "bite", after = 1.5 } } }, { note = "The bite lands unless it was killed in time", on = "timer", name = "bite", kind = "zombie", when = { { "inState", entity = "self", state = "attack" } }, act = { { "addVar", name = "health", amount = -1 }, { "addVar", name = "bites", amount = 1 }, { "flash", r = 255, g = 40, b = 40, seconds = 0.3 }, { "shake", amount = 0.3, seconds = 0.4 }, { "timerStart", entity = "self", name = "bite", after = 1.5 } } }, { note = "A miss on the picture", on = "miss", when = { { "test", expr = "not event.offscreen" } }, act = { { "addVar", name = "misses", amount = 1 } } }, { note = "The stop is clear: move on", on = "frame", when = { { "waiting", entity = "camera" }, { "test", expr = 'count("zombie") == 0' } }, act = { { "pathNext", entity = "camera" } } }, { note = "Out of health", on = "frame", when = { { "test", expr = "health <= 0" }, { "once", tag = "over", scope = "game" } }, act = { { "say", text = '"YOU ARE DEAD"', seconds = 2 }, { "gameOver" } } }, { note = "The end of the rail", on = "railEnd", act = { { "setVar", name = "done", value = true }, { "say", text = '"STAGE CLEAR"', seconds = 2 } } }, { note = "The readout, every frame", on = "frame", act = { { "setText", entity = "readout", text = '"score " .. score .. " health " .. health .. " ammo " .. gun1.ammo' } } } } }