You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: game-disks/demo-disk.js
+21-15Lines changed: 21 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
constdemoDisk={
1
+
constdemoDisk=()=>({
2
2
roomId: 'foyer',// the ID of the room the player starts in
3
3
rooms: [
4
4
{
@@ -14,7 +14,7 @@ const demoDisk = {
14
14
constroom=getRoom('foyer');
15
15
room.desc=`You are currently standing in the foyer. There's a huge **MONSTERA** plant to your right, and a massive **WINDOW** to your left bathing the room in natural light. Both the **PLANT** and the **WINDOW** stretch to the ceiling, which must be at least 25 feet high.
16
16
17
-
***Rooms** form the foundation of the engine's design. At any given time, your player will be standing in one of the rooms you built for them. These can be literal rooms like the foyer you find yourself in now, or metaphorical rooms like **The End of Time** or **Purgatory**.
17
+
***Rooms** form the foundation of the engine's design. At any given time, your player will be standing in one of the rooms you built for them. These can be literal rooms like the foyer you find yourself in now, or metaphorical rooms like **The End of Time** or **A Dream**.
18
18
19
19
Each room you create should have a description. (That's what you're reading now!)
20
20
@@ -38,7 +38,7 @@ const demoDisk = {
38
38
block: `It's far too large for you to carry.`,// optional reason player cannot pick up this item
39
39
// when player looks at the plant, they discover a shiny object which turns out to be a key
line: `A disk is a JavaScript object which describes your game. At minimum, it must have these two top-level properties:
278
+
line: `A disk is a JavaScript function returning an object which describes your game. At minimum, the returned object must have these two top-level properties:
279
279
280
280
**roomId** (*string*) - This is a reference to the room the player currently occupies. Set this to the **ID** of the room the player should start in.
281
281
@@ -440,9 +440,15 @@ const demoDisk = {
440
440
441
441
**roomId** (*string*) - The unique identifier for the room.`
442
442
},
443
+
{
444
+
option: `Tell me about **GETITEM**`,
445
+
line: `<code>getItem</code> is a function you can use to get a reference to an item in the player's inventory or in the current room. It takes one argument:
446
+
447
+
**name** (*string*) - The name of the item.`
448
+
},
443
449
{
444
450
option: `Tell me about **GETITEMINROOM**`,
445
-
line: `<code>getItemInRoom</code> is a function you can use to get a reference to an item in a particular room. It takes two arguments:
451
+
line: `<code>getItemInRoom</code> is a function you can use to get a reference to an item in any room. It takes two arguments:
446
452
447
453
**itemName** (*string*) - The name of the item.
448
454
@@ -461,7 +467,7 @@ const demoDisk = {
461
467
],
462
468
},
463
469
],
464
-
};
470
+
});
465
471
466
472
// custom functions used by this disk
467
473
// change the CSS stylesheet to the one with the passed name
0 commit comments