-- A game description: data, not code. Forge/AuthorCompile.singe turns it into a Singe game. -- -- Genre one of the two the first slice was built on. A single world2d room, a character that runs -- and jumps, a prize, and a readout. It shares nothing with the QTE beside it -- no disc, no -- branching, no time windows -- which is the point: if the core can express both, it is not -- secretly a platformer engine or secretly a laserdisc engine. return { title = "Author test: platformer", layers = { { kind = "world2d", gravity = 1500 } }, vars = { score = 0 }, kinds = { ground = { look = { kind = "box", w = 720, h = 40, r = 60, g = 70, b = 90 }, behaviours = { { kind = "solid" } } }, ledge = { look = { kind = "box", w = 180, h = 20, r = 60, g = 70, b = 90 }, behaviours = { { kind = "solid" } } }, prize = { look = { kind = "box", w = 18, h = 18, r = 255, g = 200, b = 60 }, behaviours = { { kind = "drift", vx = 0, vy = 0 } } }, hero = { look = { kind = "box", w = 24, h = 44, r = 230, g = 90, b = 170 }, behaviours = { { kind = "platformer", speed = 210, jump = 620 } } }, readout = { look = { kind = "text", text = "score 0", r = 235, g = 235, b = 245 } } }, rooms = { { name = "field", entities = { { kind = "ground", id = "ground", x = 360, y = 440 }, { kind = "ledge", id = "ledge", x = 520, y = 330 }, { kind = "prize", id = "prize", x = 520, y = 300 }, { kind = "hero", id = "hero", x = 120, y = 380 }, { kind = "readout", id = "readout", x = 12, y = 12 } } } }, rules = { { note = "Run left", on = "frame", when = { { "keyHeld", key = "LEFT" } }, act = { { "run", entity = "hero", direction = -1 } } }, { note = "Run right", on = "frame", when = { { "keyHeld", key = "RIGHT" } }, act = { { "run", entity = "hero", direction = 1 } } }, { note = "Jump, but only with ground underfoot", on = "frame", when = { { "keyHeld", key = "SPACE" }, { "onGround", entity = "hero" } }, act = { { "jump", entity = "hero" } } }, { note = "Take the prize", on = "collision", a = "hero", b = "prize", act = { { "addScore", amount = 100 }, { "destroy", entity = "other" }, { "setVar", name = "won", value = true } } }, { note = "Fallen off the world: back to the start", on = "frame", when = { { "below", entity = "hero", y = 520 } }, act = { { "moveTo", entity = "hero", x = 120, y = 380 } } }, { note = "The readout, every frame", on = "frame", act = { { "setText", entity = "readout", text = '"score " .. score' } } } } }