Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2016 18:39
Show Gist options
  • Save anonymous/5cc94af926e4d5600423dbb40b8a993e to your computer and use it in GitHub Desktop.
Save anonymous/5cc94af926e4d5600423dbb40b8a993e to your computer and use it in GitHub Desktop.
function step4(){
var chooseEquipment = prompt("Choosen equipment between 1-4");
if (chooseEquipment == 1){ return 1;}
else if (chooseEquipment == 2){ return 2;}
}
function step5(){
...................
this function should execute depending on what return value was given from step4
for instance:
if return value 1 from step4{
alert(".....");
}
function main(){
do{
initGame();
intro();
var reachedLevel = game(); // this one is ok.
if (reachedLevel == 1){alert("Reached level 1");}
else if (reachedLevel == 2){alert("Reached level 2);}
else if (reachedLevel == 3){alert("Reached level 3");}
else if (reachedLevel == 4){alert("Reached level 4");}
}while(newGame())}
function game(){
if(!step1()) {return 1; }
if(!step2()) {return 2; }
if(!step3()) {return 3; }
if(!step4()) {return 4; }
if(!step5()) {return 5; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment