Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Last active August 29, 2015 13:55
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 zeroeth/8755469 to your computer and use it in GitHub Desktop.
Save zeroeth/8755469 to your computer and use it in GitHub Desktop.
text adventure
// 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