forked from cmccarthy15/te2018grade9term1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
haunted.js
31 lines (27 loc) · 987 Bytes
/
haunted.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
const READLINE = require("readline-sync");
// use whatever properties you want for the player object
let player = {
name: undefined,
courage: 0,
intellect: 0,
strength: 0,
charm: 0,
weapon: "fists",
item: "flashlight",
};
console.log();
console.log("*** WELCOME TO THE HAUNTED HOUSE ***");
player.name = READLINE.question("What is your name?: ");
console.log(`${player.name} stands in front of a spooky haunted house.`);
console.log(`${player.name} hears what sounds like screaming coming from inside the house.`);
let enterHouse = READLINE.question("Will you enter the house? (yes or no) ");
if(enterHouse == "y" || enterHouse == "yes") {
player.courage++;
console.log(`${player.name} prepares their ${player.weapon} and opens the door...`);
// continue the story
} else {
player.intellect++;
console.log(`${player.name} decides not to open the door. However...`);
// continue the story
}
console.log("Thanks for playing!");