Last active
August 29, 2015 13:55
-
-
Save zeroeth/8755469 to your computer and use it in GitHub Desktop.
text adventure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// introduction | |
// a game with two rooms | |
// walk to next room | |
// grab an item | |
// (something good or bad happens) | |
var room1 = { | |
description: "A dark room full of holographic clowns" | |
} | |
var room2 = { | |
description: "There are 3 switches on the far wall marked DH, TE, LO and a pile of debris in the corner" | |
} | |
var walk_into_room = function(room) { | |
console.log("You enter the room"); | |
console.log(room.description); | |
} | |
var start_game = function() { | |
console.log("You wake up. You are laying in 6 inches of rice."); | |
walk_into_room(room1); | |
} | |
start_game(); | |
var flip_switch = function(switch_name) { | |
if(switch_name == "TE") { | |
console.log("The room explodes, the afterlife is filled with clowns"); | |
} | |
if(switch_name == "LO") { | |
console.log("The lights go out, the clowns begin to sing Thriller (they are very good dancers)"); | |
} | |
if(switch_name == "DH") { | |
console.log("The clowns vanish, you eat cake"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment