The Final commit before turn-in (hopefully)
This commit is contained in:
parent
44a4cf65bd
commit
77cb3f4613
8 changed files with 265 additions and 148 deletions
|
|
@ -42,7 +42,7 @@ export function radPointsCalc() { // Calculates radPoints given walk/foodrate
|
|||
|
||||
export function eatFood() { // Calculates food amount after a day of eating
|
||||
if (food == 0) {
|
||||
health = health - 0.25*walkRate
|
||||
health = health - walkRate
|
||||
} else {
|
||||
food = food - walkRate * foodRate
|
||||
}
|
||||
|
|
@ -203,8 +203,6 @@ function timeDeath() { // The death screen for passing the time limit
|
|||
|
||||
var travelFrame = 0;
|
||||
|
||||
|
||||
|
||||
export function travelScreen() {
|
||||
if (travelFrame < 0 || travelFrame > 3) {
|
||||
travelFrame = 0;
|
||||
|
|
@ -228,7 +226,15 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
if (path == 0) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
}
|
||||
if (path == 1) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-locationA));
|
||||
}
|
||||
if (path == 2) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-locationB));
|
||||
}
|
||||
travelFrame++
|
||||
} else if (travelFrame == 1) {
|
||||
console.clear();
|
||||
|
|
@ -250,7 +256,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame++
|
||||
} else if (travelFrame == 2) {
|
||||
console.clear();
|
||||
|
|
@ -272,7 +278,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame++
|
||||
} else if (travelFrame == 3) {
|
||||
console.clear();
|
||||
|
|
@ -294,7 +300,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame=0;
|
||||
}
|
||||
}
|
||||
|
|
@ -306,11 +312,6 @@ export async function walkPathMain() {
|
|||
pauseScreen();
|
||||
enableRawMode();
|
||||
}
|
||||
|
||||
if (location > 255) {
|
||||
disableRawMode();
|
||||
return;
|
||||
}
|
||||
calcLocation();
|
||||
radPointsCalc();
|
||||
healthCapCalc();
|
||||
|
|
@ -351,16 +352,25 @@ export function disableRawMode() {
|
|||
|
||||
var paused = false;
|
||||
export function pauseScreen() {
|
||||
console.clear();
|
||||
console.log ("What would you like to do?");
|
||||
console.log ("--------------------------");
|
||||
console.log ("1) Resume");
|
||||
console.log ("2) View Inventory");
|
||||
console.log ("3) View Distances");
|
||||
console.log ("4) View Stats");
|
||||
console.log ("5) Scavenge");
|
||||
console.log ("6) Change Speed/Food Rate");
|
||||
let pauseInput = userInput("Enter: ");
|
||||
let pauseInput
|
||||
while (true) {
|
||||
console.clear();
|
||||
console.log ("What would you like to do?");
|
||||
console.log ("--------------------------");
|
||||
console.log ("1) Resume");
|
||||
console.log ("2) View Inventory");
|
||||
console.log ("3) View Distances");
|
||||
console.log ("4) View Stats");
|
||||
console.log ("5) Scavenge");
|
||||
console.log ("6) Change Speed/Food Rate");
|
||||
pauseInput = userInput("Enter: ");
|
||||
|
||||
if (pauseInput != "1" && pauseInput != "2" && pauseInput != "3" && pauseInput != "4" && pauseInput != "5" && pauseInput != "6") {
|
||||
console.log("Invalid input. Please enter 1, 2, or 3.");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(pauseInput) {
|
||||
case "1":
|
||||
paused = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue