stories.push({ "id": "demo", "info": { "name": "Tech Demo", "desc": "Shows what the game engine can do", "tags": [] }, "intro": { "start": "Home", "setup": () => { state.info.time.value = 3600; state.player.stats.oofs = {name: "Oofs", type: "meter", value: 0, max: 10, get color() { return "rgb(" + (155 + this.value*10) + ",0,0)"}}; state.player.stats.number = {name: "Number", type: "counter", value: 0, max: 10, color: "rgb(255,255,255)"}; }, "intro": () => { print(["don't fall down the stairs ok"]); } }, "sounds": [ "sfx/oof.ogg" ], "preload": [ ], "world": { "Stairs": { "id": "Stairs", "name": "Stairs", "desc": "You can't actually get here" }, "Home": { "id": "Home", "name": "Home", "desc": "Where the wifi autoconnects", "move": (room) => { print(["You go back to your living room"]); }, "enter": (room) => { print(["*sound of you entering your house*"]); startTimer({ id: "room-counter", func: () => { state.world["Home"].data.stats.number.value += 1; return true; }, delay: 1000, loop: true, classes: [ "Home" ], }); }, "exit": (room) => { print(["You are exiting your house"]); stopClassTimers("Home"); }, "actions": [ { "name": "Squint", "desc": "Squint in a very aggressive manner", "execute": (room) => { state.player.rooms[room.id].squinted = true; print(["You stare at the wall and notice a secret door. But where is the key?"]); } }, { "name": "Find Keys", "desc": "Find your keys", "execute": (room) => { state.player.items.keys.push("Locked Room"); print(["You found your keys under the couch cushions"]); }, "show": [ (room) => { return state.player.rooms[room.id].squinted; }, (room) => { return !state.player.items.keys.includes("Locked Room"); } ] } ], "exits": { "up": { "target": "Locked Room", "desc": "It's locked!", "conditions": [ (room) => { return state.player.items.keys.includes("Locked Room"); } ], "show": [ (room) => { return state.player.rooms[room.id].squinted; } ] }, "descend": { "target": "Stairs", "desc": "Dare you go down the stairs?", "hooks": [ (room, exit) => { console.log(state) print(["You're very concerned that you'll fall down all these stairs."]); return false; } ] } }, "hooks": [ (room) => { print(["This is a test of the hooks"]); return true; } ], "data": { "stats": { number: {name: "Seconds In Room", type: "counter", value: 0, color: "rgb(255,0,0)"} } } }, "Locked Room": { "id": "Locked Room", "name": "Locked Room", "desc": "Super seecret", "move": (room) => { print(["You enter the locked room. wowie!"]); }, "actions": [ { name: "Oof", desc: "Oof", execute: (room) => { state.player.stats.oofs.value += 1; if (state.player.stats.oofs.value >= state.player.stats.oofs.max) { state.player.stats.oofs.value = state.player.stats.oofs.max; print(["Big oof"]); } else { print(["Oof"]); } playSfx("sfx/oof.ogg"); } } ], "exits": { "down": { "target": "Home", "desc": "Back to home", "hooks": [ (room, exit) => { print(["Potato"]); return true; } ] } }, "data": { "stats": { } } } } });