My comments.

This commit is contained in:
Raktbastr 2025-04-28 12:19:02 -05:00
parent 77cb3f4613
commit a8c9d868be
6 changed files with 147 additions and 84 deletions

View file

@ -1,8 +1,13 @@
// 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();
@ -14,6 +19,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?");
@ -24,6 +30,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 {
@ -49,7 +56,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...")