a munch adventure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

176 lines
4.5 KiB

  1. stories.push({
  2. "id": "demo",
  3. "info": {
  4. "name": "Tech Demo",
  5. "desc": "Shows what the game engine can do",
  6. "tags": []
  7. },
  8. "intro": {
  9. "start": "Home",
  10. "setup": () => {
  11. state.info.time.value = 3600;
  12. state.player.stats.oofs = {name: "Oofs", type: "meter", value: 0, max: 10, get color() { return "rgb(" + (155 + this.value*10) + ",0,0)"}};
  13. state.player.stats.number = {name: "Number", type: "counter", value: 0, max: 10, color: "rgb(255,255,255)"};
  14. },
  15. "intro": () => {
  16. print(["<b>don't fall down the stairs ok</b>"]);
  17. }
  18. },
  19. "sounds": [
  20. "sfx/oof.ogg"
  21. ],
  22. "preload": [
  23. ],
  24. "world": {
  25. "Stairs": {
  26. "id": "Stairs",
  27. "name": "Stairs",
  28. "desc": "You can't actually get here"
  29. },
  30. "Home": {
  31. "id": "Home",
  32. "name": "Home",
  33. "desc": "Where the wifi autoconnects",
  34. "move": (room) => {
  35. print(["You go back to your living room"]);
  36. },
  37. "enter": (room) => {
  38. print(["*sound of you entering your house*"]);
  39. startTimer({
  40. id: "room-counter",
  41. func: () => {
  42. state.world["Home"].data.stats.number.value += 1;
  43. return true;
  44. },
  45. delay: 1000,
  46. loop: true,
  47. classes: [
  48. "Home"
  49. ],
  50. });
  51. },
  52. "exit": (room) => {
  53. print(["You are exiting your house"]);
  54. stopClassTimers("Home");
  55. },
  56. "actions": [
  57. {
  58. "name": "Squint",
  59. "desc": "Squint in a very aggressive manner",
  60. "execute": (room) => {
  61. state.player.rooms[room.id].squinted = true;
  62. print(["You stare at the wall and notice a secret door. But where is the key?"]);
  63. },
  64. "conditions": [
  65. (room) => {
  66. return !state.player.rooms[room.id].squinted;
  67. }
  68. ]
  69. },
  70. {
  71. "name": "Find Keys",
  72. "desc": "Find your keys",
  73. "execute": (room) => {
  74. state.player.items.keys.push("Locked Room");
  75. print(["You found your keys under the couch cushions"]);
  76. },
  77. "show": [
  78. (room) => {
  79. return state.player.rooms[room.id].squinted;
  80. },
  81. (room) => {
  82. return !state.player.items.keys.includes("Locked Room");
  83. }
  84. ]
  85. }
  86. ],
  87. "exits": {
  88. "up": {
  89. "target": "Locked Room",
  90. get desc() {
  91. return state.player.items.keys.includes("Locked Room") ? "It's locked, but at least you have the key" : "It's locked!";
  92. },
  93. "conditions": [
  94. (room) => {
  95. return state.player.items.keys.includes("Locked Room");
  96. }
  97. ],
  98. "show": [
  99. (room) => {
  100. return state.player.rooms[room.id].squinted;
  101. }
  102. ]
  103. },
  104. "descend": {
  105. "target": "Stairs",
  106. "desc": "Dare you go down the stairs?",
  107. "hooks": [
  108. (room, exit) => {
  109. console.log(state)
  110. print(["You're very concerned that you'll fall down all these stairs."]);
  111. return false;
  112. }
  113. ]
  114. }
  115. },
  116. "hooks": [
  117. (room) => {
  118. print(["This is a test of the hooks"]);
  119. return true;
  120. }
  121. ],
  122. "data": {
  123. "stats": {
  124. number: {name: "Seconds In Room", type: "counter", value: 0, color: "rgb(255,0,0)"}
  125. }
  126. }
  127. },
  128. "Locked Room": {
  129. "id": "Locked Room",
  130. "name": "Locked Room",
  131. "desc": "Super seecret",
  132. "move": (room) => {
  133. print(["You enter the locked room. wowie!"]);
  134. },
  135. "actions": [
  136. {
  137. name: "Oof",
  138. desc: "Oof",
  139. execute: (room) => {
  140. state.player.stats.oofs.value += 1;
  141. if (state.player.stats.oofs.value >= state.player.stats.oofs.max) {
  142. state.player.stats.oofs.value = state.player.stats.oofs.max;
  143. print(["Big oof"]);
  144. } else {
  145. print(["Oof"]);
  146. }
  147. playSfx("sfx/oof.ogg");
  148. }
  149. }
  150. ],
  151. "exits": {
  152. "down": {
  153. "target": "Home",
  154. "desc": "Back to home",
  155. "hooks": [
  156. (room, exit) => {
  157. print(["Potato"]);
  158. return true;
  159. }
  160. ]
  161. }
  162. },
  163. "data": {
  164. "stats": {
  165. }
  166. }
  167. }
  168. }
  169. });