-- Written by Forge/AuthorCompile.singe. Edit by hand or in the editor; either is fine. return { layers = { { gravity = 1500, kind = "world2d" } }, rooms = { { entities = { { id = "ground", type = "ground", x = 360, y = 440 }, { id = "hero", type = "hero", x = 200, y = 420 }, { id = "readout", type = "readout", x = 12, y = 12 }, { id = "coin", type = "coin", x = 300, y = 392 }, { id = "coin1", type = "coin", x = 420, y = 392 }, { id = "coin2", type = "coin", x = 560, y = 300 }, { id = "spike", type = "spike", x = 640, y = 420 }, { id = "door", type = "door", x = 700, y = 420 } }, name = "start", tracks = {} }, { entities = { { id = "ground", type = "ground", x = 360, y = 440 }, { id = "readout", type = "readout", x = 12, y = 12 }, { id = "coin", type = "coin", x = 400, y = 392 } }, name = "cave", tracks = {} } }, rules = { { act = { { "run", direction = -1, entity = "hero" } }, note = "Run left", on = "frame", when = { { "keyHeld", key = "LEFT" } } }, { act = { { "run", direction = 1, entity = "hero" } }, note = "Run right", on = "frame", when = { { "keyHeld", key = "RIGHT" } } }, { act = { { "jump", entity = "hero" }, { "playSound", file = "Forge/kit/jump.wav" } }, note = "Jump, with ground underfoot", on = "frame", when = { { "onGround", entity = "hero" }, { "keyPressed", key = "SPACE" } } }, { act = { { "setText", entity = "readout", text = "\"score \" .. score" } }, note = "The readout, every frame", on = "frame" }, { a = "coin", act = { { "addScore", amount = 10 }, { "destroy", entity = "self" }, { "playSound", file = "Forge/kit/coin.wav" } }, b = "hero", note = "Take a coin", on = "enter", when = {} }, { a = "spike", act = { { "moveTo", entity = "hero", x = 200, y = 380 }, { "playSound", file = "Forge/kit/hit.wav" } }, b = "hero", note = "Spikes hurt", on = "enter", when = {} }, { a = "door", act = { { "goTo", entity = "hero", room = "cave", x = 60, y = 380 } }, b = "hero", note = "Through the door", on = "enter", when = {} }, { act = { { "playMusic", file = "Forge/kit/loop.ogg" } }, note = "Music", on = "roomStart", when = {} } }, title = "New game", types = { coin = { behaviours = { { kind = "trigger" }, { kind = "spin", rate = 180 } }, look = { file = "Forge/kit/coin.png", kind = "sprite" }, vars = {} }, door = { behaviours = { { kind = "trigger" } }, look = { anchor = "feet", file = "Forge/kit/door.png", kind = "sprite" }, vars = {} }, ground = { behaviours = { { kind = "solid" } }, look = { b = 90, g = 70, h = 40, kind = "box", r = 60, w = 720 } }, hero = { behaviours = { { jump = 620, kind = "platformer", speed = 260 }, { fps = 10, kind = "frames", states = "idle=1-1, walk=2-5, jump=6-6, fall=7-7" } }, look = { file = "Forge/kit/hero.png", frames = 8, kind = "sprite" }, vars = {} }, readout = { look = { b = 245, g = 235, kind = "text", r = 235, text = "score 0" } }, spike = { behaviours = { { kind = "trigger" } }, look = { anchor = "feet", file = "Forge/kit/spike.png", kind = "sprite" }, vars = {} } }, vars = { score = 0 } }