Dungeon Dragons

A small JS game.

by turkey3

HTML

<!DOCTYPE html>
    <body>
        <div align=center>
            <input onclick='run()' value='start'type='button' /><input onclick='stop()' value='stop'type='button' /></div>
        <div id='output'></div>
    </body>
</html>

CSS

#output {
    width:83%;
    height:20em;
    padding:1em;
    margin:1em auto 1em auto; /*what this does is centers it horizontally*/
    /*top right bottom left for margin is the order*/
    border:2px solid #0099FF; /*0099FF is a color code and i kind of remember those*/
    border-radius:1em;
    -moz-border-radius:1em; /*browser compatibility whats this*/ /*some browsers only recognize this and fail to recognize border-radius alone, don't ask me why*/
    -webkit-border-radius:1em;
}
input {
    display:block;
    margin:.3em;
}
}

JavaScript

window.output = function(text) {
    var box = document.getElementById('output');
    var currentText = box.innerHTML;
    box.innerHTML = currentText + text;
}
window.run = function() {
    output('<p>Game beginning</p>');
    var response = confirm("Would you like to enter the dungeon?");
    if(response == true) {
        output('<p>Now entering the dungeon!</p>');
        var asking = true;
        while(asking == true) {
            
        }
    } else {
        output('<p>Mission aborted!</p>');
    }
}
//They are very similar to Scratch's repeat until, only in reverse. In this case we will need to use a while loop because we will need to keep asking the question until the user provides a valid answers.
//If we ask what tunnel he/she wants to go down and we ask for 1,2, or 3 and the user says "salad" we have to ask the question again.