Pre-release
AdventureJS Docs Downloads Bundler Devlog Score: 0 Moves: 0
Example showing how to create an Infocom layout for AdventureJS. tutorial, Infocom ClassicLayout styles

Display & Layouts:Infocom (aka Classic)

This is the default text-only style, aka The Classic, as seen in most of Infocom's games such as the Zork trilogy, the Enchanter trilogy, and The Hitchhiker's Guide to the Galaxy. .

 

// ClassicLayout.js
/* global AdventureJS A Game */

var ClassicLayout = new AdventureJS.Game(
  "ClassicLayout",
  "ClassicLayoutContainer"
);

ClassicLayout.settings.set({
  display: "inline",
  layout: "classic",
  title: "Classic Layout",
  author: "Ivan Cockrum",
  description: "Here is an example of the classic Infocom layout. ",
  version: "0.0.1",
});

ClassicLayout.createAsset({
  class: "Player",
  name: "Explorer",
  place: { in: "Start Room" },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "indigo pencil",
  a: "an",
  adjectives: "indigo, colored",
  place: { in: "Start Room" },
  description: "It's an indigo colored pencil. ",
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "violet pencil",
  article: "a",
  adjectives: "violet, colored",
  place: { in: "Start Room" },
  description: "It's a violet colored pencil. ",
});
ClassicLayout.createAsset({
  class: "Entity",
  name: "paint brush",
  article: "a",
  // adjectives: "",
  place: { in: "Start Room" },
  description: "It's a number 12 paint brush. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Start Room",
  description: `
    This is the Start Room.
  `,
  exits: {
    east: "East Room",
    west: "West Room",
    north: "North Room",
    south: "South Room",
  },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "yellow pencil",
  article: "a",
  adjectives: "yellow, colored",
  place: { in: "Start Room" },
  description: "It's a yellow colored pencil. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "North Room",
  description: `This is the North Room. `,
  exits: {
    northwest: "Northwest Room",
    northeast: "Northeast Room",
    south: "Start Room",
  },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "blue pencil",
  article: "a",
  adjectives: "blue, colored",
  place: { in: "North Room" },
  description: "It's a colored pencil, zinc blue. ",
});
ClassicLayout.createAsset({
  class: "Crayon",
  name: "pink crayon",
  article: "a",
  adjectives: "pink, colored",
  place: { in: "North Room" },
  description: "It's a pink crayon. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "South Room",
  description: `This is the South Room. `,
  exits: {
    north: "Start Room",
    southwest: "Southwest Room",
    southeast: "Southeast Room",
  },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "red pencil",
  article: "a",
  adjectives: "red, colored",
  place: { in: "South Room" },
  description: "It's a red colored pencil. ",
});
ClassicLayout.createAsset({
  class: "Crayon",
  name: "white crayon",
  article: "a",
  adjectives: "white, colored",
  place: { in: "South Room" },
  description: "It's a white crayon. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "East Room",
  description: `This is the East Room. `,
  exits: {
    west: "Start Room",
    in: "In Room",
  },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "orange pencil",
  // article: "a",
  adjectives: "orange, colored",
  place: { in: "East Room" },
  description: "It's an orange colored pencil. ",
});
ClassicLayout.createAsset({
  class: "Crayon",
  name: "maroon crayon",
  article: "a",
  adjectives: "maroon, colored",
  place: { in: "East Room" },
  description: "It's a maroon crayon. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "West Room",
  description: `This is the West Room. `,
  exits: {
    east: "Start Room",
    out: "Out Room",
  },
});
ClassicLayout.createAsset({
  class: "Pencil",
  name: "green pencil",
  article: "a",
  adjectives: "green, colored",
  place: { in: "West Room" },
  description: "It's a green colored pencil. ",
});
ClassicLayout.createAsset({
  class: "Crayon",
  name: "plum crayon",
  article: "a",
  adjectives: "plum, colored",
  place: { in: "West Room" },
  description: "It's a plum crayon. ",
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Northwest Room",
  description: `This is the Northwest Room. `,
  exits: {
    southeast: "North Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Northeast Room",
  description: `This is the Northeast Room. `,
  exits: {
    southwest: "North Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Southwest Room",
  description: `This is the Southwest Room. `,
  exits: {
    northeast: "South Room",
    down: "Down Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Southeast Room",
  description: `This is the Southeast Room. `,
  exits: {
    northwest: "South Room",
    up: "Up Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "In Room",
  description: `This is the In Room. `,
  exits: {
    out: "East Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Out Room",
  description: `This is the Out Room. `,
  exits: {
    in: "West Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Down Room",
  description: `This is the Down Room. `,
  exits: {
    up: "Southwest Room",
  },
});

ClassicLayout.createAsset({
  class: "Room",
  name: "Up Room",
  description: `This is the Up Room. `,
  exits: {
    down: "Southeast Room",
  },
});

Demo Source files

Right-click and choose "Save as..." to download source files.

Notes:

  • Demo games are set to a small size to fit doc pages. They can easily be enlarged via display settings.
  • Demo games all use the same theme. Colors and fonts can be changed via custom CSS.
  • Demo games don't include the core AdventureJS code. To run downloaded games locally, you'll need to also download copies of the core JS and CSS and set up this local folder structure.
AdventureJS
└── js
|   └── adventure.min.js
└── css
|   └── adventurejs.min.css
└── games
    ├── demogame01
    ├── demogame02
    └── demogame03