Pre-release
AdventureJS Docs Downloads Bundler Devlog Score: 0 Moves: 0
Example showing how to create a Legend Entertainment layout for AdventureJS. tutorial, Legend Entertainment LegendLayout styles

Display & Layouts:Legend Layout

This example shows a layout in the style of Legend Entertainment games such as Eric the Unready, Gateway and Homeworld, and the Spellcasting trilogy.

 

// LegendLayout.js
/* global AdventureJS A LegendLayout G */

var LegendLayout = new AdventureJS.Game(
  "LegendLayout",
  "LegendLayoutContainer"
);

LegendLayout.settings.set({
  display: "inline",
  layout: "legend",
  title: "Legend Layout",
  author: "Ivan Cockrum",
  description:
    "Here is an example follows the Legend Entertainment game layout. ",
  version: "0.0.1",
});

LegendLayout.createImageLookup({
  images: [
    {
      id: "startroom",
      src: "images/startroom.png",
    },
    {
      id: "northroom",
      src: "images/northroom.png",
    },
    {
      id: "southroom",
      src: "images/southroom.png",
    },
    {
      id: "eastroom",
      src: "images/eastroom.png",
    },
    {
      id: "westroom",
      src: "images/westroom.png",
    },
  ],
});

// Create the room image widget.
LegendLayout.createWidget({
  class: "RoomImage",
  id: "MyRoomImageWidget",
  cssclasses: ["custom", "room"],
  region: "header",
  messages: {
    randomize: true,
    frequency: 0.33,
    array: [
      "{We} clicked the picture, but there's no need for that. It's just a visual reference. ",
      "There's no need to click. Sorry, but this isn't a point & click game.",
      "Move on, there's nothing to do in the picture. ",
      "Whattaya think this is, a point & click game? ",
    ],
  },
});

// Create the first verb list widget.
LegendLayout.createWidget({
  class: "VerbList",
  id: "VerbList01",
  cssclasses: [],
  region: "left",
  verbs: [
    { verb: "help", parse: true },
    { verb: "inventory", parse: true },
    { verb: "look", parse: true },
  ],
});

// Create the second verb list widget.
LegendLayout.createWidget({
  class: "VerbList",
  id: "VerbList02",
  cssclasses: [],
  region: "left",
  verbs: [
    "examine",
    "take",
    "drop",
    "open",
    "close",
    "look",
    "read",
    "ask",
    "put",
    "wait",
    "undo",
    "save",
    "restore",
    "restart",
    "quit",
    "again",
    "aim",
    "attach",
    "break",
    "brief",
    "bury",
    "button",
    "catch",
    "climb",
    "close",
    "crawl",
    "cut",
    "descend",
    "detach",
    "dig",
    "dip",
    "dismount",
    "draw",
    "drink",
    "drive",
    "drop",
    "eat",
    "empty",
    "erase",
  ],
});

// Create the compass widget.
LegendLayout.createWidget({
  class: "Compass",
  id: "CompassWidget",
  format: "rose2",
  cssclasses: [],
  region: "right",
});

// Create the object widget.
LegendLayout.createWidget({
  class: "ObjectList",
  id: "ObjectList",
  cssclasses: [],
  region: "right",
});

LegendLayout.createAsset({
  class: "Player",
  name: "Explorer",
  place: { in: "Start Room" },
});

LegendLayout.createAsset({
  class: "Room",
  name: "Start Room",
  image: "startroom",
  description: `
    This is the Start Room. There's not much to say about it.
  `,
  exits: {
    east: "East Room",
    west: "West Room",
    north: "North Room",
    south: "South Room",
  },
});

LegendLayout.createAsset({
  class: "Room",
  name: "North Room",
  image: "northroom",
  description: `This is the North Room. We don't have much to say about it. `,
  exits: {
    south: "Start Room",
  },
});

LegendLayout.createAsset({
  class: "Room",
  name: "South Room",
  image: "southroom",
  description: `This is the South Room. We don't have much to say here either.`,
  exits: {
    north: "Start Room",
  },
});

LegendLayout.createAsset({
  class: "Room",
  name: "East Room",
  image: "eastroom",
  description: `This is the East Room. Brevity is the soul of wit. Or so we've been told. `,
  exits: {
    west: "Start Room",
  },
});

LegendLayout.createAsset({
  class: "Room",
  name: "West Room",
  image: "westroom",
  description: `This is the West Room. The less said the better. `,
  exits: {
    east: "Start Room",
  },
});

LegendLayout.createAsset({
  class: "Entity",
  name: "Thing One",
  place: { in: "Start Room" },
});

LegendLayout.createAsset({
  class: "Entity",
  name: "Thing Two",
  place: { in: "Start Room" },
});

LegendLayout.createAsset({
  class: "Entity",
  name: "Another Thing",
  place: { in: "Start Room" },
});

LegendLayout.createAsset({
  class: "NPC",
  name: "Floyd",
  // proper_name: "Floyd",
  pronouns: "nonhuman",
  gender: "male",
  // use_proper_name: true,
  name_is_proper: true,
  place: { in: "Start Room" },
  // use_articles: false,
});

LegendLayout.createAsset({
  class: "Entity",
  name: "raygun",
  place: { in: "Start Room" },
});

LegendLayout.createAsset({
  class: "Clothing",
  name: "pair of boots",
  synonyms: ["pair", "boots"],
  place: { in: "Start 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