This commit is contained in:
Caroline Foy 2025-04-29 14:01:20 -05:00
commit a540fb6518
6 changed files with 147 additions and 84 deletions

View file

@ -1,10 +1,15 @@
//Created by student A and B collaobratively
// Program is started from here, runs functions from other files.
// In order to use variables and functions from other files we must import them as shown below
// To import functions we use the syntax below
import { userInput, sleep, disableRawMode, walkPathMain, randomNumber } from './functions.js';
import { forcedEncounter, naturalEncounter } from './encounters.js';
import { ravenRockStore } from './shops.js';
// To import variables from a file you must mark them as global (done in file) and import the file they are in like shown below.
import './variables.js';
disableRawMode();
console.clear();
@ -16,6 +21,7 @@ console.log(" / / ) / / / ) / / / o / / ) / )
console.log("_/________(___(_/___/___(___/_(___(__(_ __o_____/____/_(___/_/___/_(___ _(__)_(___/_/_/__/_(___ _____/_____|__(___/_(___(_(___/___\n\n");
await sleep(1);
// Collects player input for menus
var mainMenuInput;
while (true) {
console.log("What would you like to do?");
@ -26,6 +32,7 @@ while (true) {
console.log("4) Credits\n");
mainMenuInput = userInput("Enter: ");
// Input validation
if (mainMenuInput != "1" && mainMenuInput != "2" && mainMenuInput != "3" && mainMenuInput != "4") {
console.log("Invalid input. Please enter 1, 2, or 3.");
} else {
@ -51,7 +58,11 @@ switch(mainMenuInput) {
break;
}
function startGame() { // So far what I have is filler and testing, feel free to change.
// startGame() function
// Walks player through character creation, story, and sets starting stats. Then opens up ravenRockStore() before
// runing the walkPath() function loop.
function startGame() {
console.clear();
name = userInput("What is your name? ");
console.log(name+" Is now your name...")