Skip to content

Instantly share code, notes, and snippets.

@BrennaBlackwell
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrennaBlackwell/27e3e81b2a7ee2b5c9f0 to your computer and use it in GitHub Desktop.
Save BrennaBlackwell/27e3e81b2a7ee2b5c9f0 to your computer and use it in GitHub Desktop.
Dragon Adventure Game for 100 Girls of Code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My Own Adventure Game</title>
</head>
<body>
<h1>My Adventure Game!</h1>
<script language="Javascript">
var adventurer = window.prompt("What is your name, adventurer?")
document.write("<p>Welcome, " + adventurer + "!</p>")
var fightDragon = window.prompt("Do you want to fight a dragon?")
fightDragon = fightDragon.toLowerCase()
if (fightDragon == 'yes') {
document.write("<p>You have defeated the dragon!</p>")
} else if (fightDragon == 'no') {
document.write("<p>You have a tea party with the dragon!</p>")
} else {
document.write("<p>The dragon doesn't know what you're doing, so it took a nap</p>")
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment