Examples:Cloak of Darkness
This is an implementation of Cloak of Darkness for AdventureJS. Cloak of Darkness is a sort of "hello world" for interactive fiction systems; a simple game that demonstrates how to apply common authoring techniques in each system.
// CloakOfDarkness.js
/* global AdventureJS A CloakOfDarkness C */
// We're naming the game object CloakOfDarkness but creating a shortcut C
var CloakOfDarkness,
C = new AdventureJS.Game("CloakOfDarkness", "CloakOfDarknessDisplay");
C.settings.set({
title: "Cloak of Darkness",
author: "Ivan Cockrum",
description: "Welcome... to the cloak of darkness!",
version: "0.0.1",
});
C.createAsset({
class: "Player",
place: { in: "Foyer" },
name: "Opera Fan",
});
C.createAsset({
class: "Room",
name: "Foyer",
description:
"This empty room has doors to the south and west, also an unusable exit to the north. There is nobody else around. ",
exits: {
south: "Bar",
west: "Cloakroom",
north: `{We} can't go that way. `,
},
});
C.createAsset({
class: "Room",
name: "Bar",
description: " ",
exits: {
north: "Bar",
},
});
C.createAsset({
class: "Room",
name: "Cloakroom",
description: " ",
exits: {
east: "Foyer",
},
});
C.createAsset({
class: "Thing",
name: "hook",
description: "",
});
C.createAsset({
class: "Clothing",
name: "black velvet cloak",
description: "",
is: {
worn: true,
},
});
C.createAsset({
class: "Thing",
name: "sawdust",
description: "",
});
C.introcard.set({
hide_statusbar: true,
// hide_titlebar: true,
prompt_to_continue: true,
prompt_text: `[Press any key to continue...]`,
clear_on_continue: true,
show_statusbar_on_continue: true,
show_titlebar_on_continue: true,
text: `
{title}
Version {version}
By {author}
It's a description all about the cloak of darkness.
`,
});
C.outrocard.set({});