Help with JS game

Help with JS game
0.0 0

#1

Hello I am trying to make a game where you choose your adventure, but when but when I choose Ms. Geri. I have to choose her twice in order for her question to pop up. Not sure where I went wrong.

var user = prompt(“Let’s Play Martin the TV Show! Which character are you?”);

if (user == “Martin”) {
prompt(“You the Man! Would you like to deal with Brotha Man or Ms. Geri?”)

if (“Brotha Man”){
var bm = prompt(“Brotha Man wants a sandwich? Do you give him a sandwich or kick him out?”);
switch (bm) {
case “sandwich”:
alert (“BAD IDEA! You’ll need more than a sandwich to feed him?”);
case “kick him out”:
alert(“GOOD IDEA! Brotha Man will eat you out of house and home.”);
break;
default:
console.log(“You must choose sandwich or kick him out.”)
break;
} else if (“Ms Geri”) {
var mg = prompt(“Ms. Geri is ready to fight because you cut the line at the DMV. Do you fight or flight?”);
switch (mg) {
case “fight”:
alert (“BAD IDEA! Ms. Geri is a bar knuckles boxing champ.”);
case “flight”:
alert(“GOOD IDEA! Ms. Geri would’ve knocked you out with one punch.”);
break;
default:
console.log(“You must choose sandwich or kick him out.”)
break;
}
} else {
console.log(“You must choose Brotha Man or Ms. Geri.”)
}
}
}


#2

you need to close “if (“Brotha Man”)” with } prior to the “else if (“Ms Geri”)” – as it stands you have the latter occurring directly after the switch


#3

also “if (“Brotha Man”)” will always be true since you don’t compare it to anything. I think you forgot to store the second promt in a variable to compare the answer with “Brotha Man” and “Ms Geri”


#4

@tommypepsi thanks for your help. still having the same issue. but the code is working right up until that point.