-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathnew-disk-template.js
61 lines (59 loc) · 2.45 KB
/
new-disk-template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This simple game disk can be used as a starting point to create a new adventure.
// Change anything you want, add new rooms, etc.
const newDiskTemplate = () => ({
roomId: 'start', // Set this to the ID of the room you want the player to start in.
rooms: [
{
id: 'start', // Unique identifier for this room. Entering a room will set the disk's roomId to this.
name: 'The First Room', // Displayed each time the player enters the room.
desc: `There's a door to the NORTH, but it is overgrown with VINES. Type ITEMS to see a list of items in the room.`, // Displayed when the player first enters the room.
items: [
{
name: 'door',
desc: 'It leads NORTH.', // Displayed when the player looks at the item.
onUse: () => println(`Type GO NORTH to try the door.`), // Called when the player uses the item.
},
{
name: ['vines', 'vine'], // The player can refer to this item by either name. The game will use the first name.
desc: `They grew over the DOOR, blocking it from being opened.`,
},
{
name: 'axe',
desc: `You could probably USE it to cut the VINES, unblocking the door.`,
isTakeable: true, // Allows the player to take the item.
onUse() {
// Remove the block on the room's only exit.
const room = getRoom('start');
const exit = getExit('north', room.exits);
if (exit.block) {
delete exit.block;
println(`You cut through the vines, unblocking the door to the NORTH.`);
// Update the axe's description.
getItem('axe').desc = `You USED it to cut the VINES, unblocking the door.`;
} else {
println(`There is nothing to use the axe on.`);
}
},
}
],
exits: [
{
dir: 'north', // "dir" can be anything. If it's north, the player will type "go north" to get to the room called "A Forest Clearing".
id: 'clearing',
block: `The DOOR leading NORTH is overgrown with VINES.`, // If an exit has a block, the player will not be able to go that direction until the block is removed.
},
],
},
{
id: 'clearing',
name: 'A Forest Clearing',
desc: `It's a forest clearing. To the SOUTH is The First Room.`,
exits: [
{
dir: 'south',
id: 'start',
},
],
}
],
});