1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help creating javascript choose your own adventure

Discussion in 'JavaScript' started by Hqman, Nov 28, 2017.

  1. #1
    I was wondering if anyone in the community could help me use javascript to create a choose your own adventure for a project, I was hoping to make it pokemon themed. I have a little bit of it but I was hoping someone could help me add to it. I would myself but I am very new to this and I have no idea how to add more to the possible options and make the game last longer with deeper pathways so far this is what I have


    var Chimchar = prompt("You are leaving Twin Leaf Town and you cross a bush with a wild Chimchar, do you FIGHT or RUN ").toUpperCase();

    switch (Chimchar) {
    case 'FIGHT':
    var turtwig = prompt("do you play turtwig, you have a piplup (YES or NO)?").toUpperCase();
    var piplup = prompt("you play piplup, hit yes to continue").toUpperCase();
    if (turtwig === 'NO' || piplup === 'YES') {
    prompt("Piplup uses swim and the chimchar faints, the water move is very effective against the fire type ");
    } else {
    prompt("Chimchar uses flamethrower and you faint, the fire type move is very effective against your grass type ");
    }

    break;
    case 'CATCH':
    var pokeball = prompt("DO you want to throw a pokeball (YES or NO)?").toUpperCase();

    if (pokeball === 'YES' ) {
    prompt("You throw the pokeball, it rattles for a little bit and then it turns red, showing you that you have caught the pokemon ");
    } else {
    Prompt("The pokemon runs away ");
    }
    break;
    case 'RUN':
    var RUN = prompt("are you sure you want to run (YES or NO)?").toUpperCase();

    if (RUN === 'YES' ) {

    prompt("You run away suffering no consequences and return to Twin leaf Town ");
    }
    if (RUN === 'NO' ){
    prompt("You continue looking for other pokemon so that you can catch them all");
    }

    break;
    default:
    prompt("I didn't understand your choice. Hit Run and try again, this time picking FIGHT, PAY, or RUN!");
    }

    I would really appreciate any advice or additional code-thanks
     
    Hqman, Nov 28, 2017 IP