A trivial parser-based room-escape game, completeable in minutes if not seconds, written using Adventuron Classroom (desktop PC required for editor).

This game is intended to be referenced from this coding tutorial:

https://medium.com/@model_train/code-a-room-escape-game-in-an-hour-with-adventuron-68db30c4b6af

Graphic Credits

  • Door graphic by Dylan Barry
  • Key graphic by Chris Ainsley

Source code:

####################################
## Trivial Room Escape (Adventuron)
## Written May 19th 2019
####################################

start_at = cell

locations {
   cell : location "You are in your cell. You see a door, a bed, and bland wallpaper adorns the walls." ;
}

objects {
   wallpaper : object "a strip of wallpaper" ;
   pen       : object "a pen"                ;
   key       : object "a small key"          ;
}

booleans {
   is_key_in_keyhole   : boolean "true"  ;
   is_key_on_paper     : boolean "false" ;
   is_paper_under_door : boolean "false" ;
}

on_command {

   : match "search bed; examine bed"  {
      : if (has_not_created "pen") {
         : print "You find something" ;
         : create "pen" ;
         : press_any_key ;
         : redescribe;
      }
   }
   
   : match "examine wallpaper"  {
      : if (has_not_created "wallpaper") {
         : create "wallpaper" ;
         : print "A piece of the wallpaper falls away" ;
         : press_any_key ;
         : redescribe;
      }
      : else {
         : print "You think you should leave the rest of the wallpaper in place." ;
      }
   }
   
   : match "examine door"  {
      : print "A solid looking oak door with a keyhole." ;
      : if (is_paper_under_door) {
         : print "The wallpaper is peeking out from under the door." ;
      }
   }
   
   : match "examine keyhole"  {
      : if (is_key_in_keyhole) {
         : print "There appears to be a key in the keyhole on the other side of the door." ;
      }
      : else {
         : print "The key is no longer in the keyhole.\nYou can't see anything else of interest due to the darkness." ;
      }
   }
   
   : match "slide wallpaper;insert wallpaper;place wallpaper"  {
      : if (is_carried "wallpaper") {
         : if (noun2_is "door") {
            : if (is_paper_under_door) {
               : print "You can't slide it under the door any more." ;
            }
            : else {
               : print "You slide the wallpaper under the door." ;
               : set_true "is_paper_under_door" ;
               : destroy "wallpaper" ;
            }
         }
         : else {
            : print "Where?" ;
         }
      }
      : else {
         : print "You don't have it." ;
      }
   }
   
   : match "poke keyhole; poke key; insert pen; put pen"  {
      : if (is_key_in_keyhole) {
         : if (is_carried "pen" && (noun2_is "pen" || noun2_is "keyhole" )) {
            : set_false "is_key_in_keyhole" ;
            : if (is_paper_under_door) {
               : print "The key falls onto the paper." ;
               : set_true "is_key_on_paper" ;
            }
            : else {
               : print "The key falls onto the floor behind the door and bounces away." ;
               : print "More planning is perhaps required." ;
               : print "GAME OVER" ;
               : end_game ;
            }
         }
         : else {
            : print "Your finger is too big." ;
         }
      }
      : else {
         : print "The key has already fallen" ;
      }
   }
   
   : match "pull paper; get paper"  {
      : if (is_paper_under_door) {
         : pocket "wallpaper" ;
         : if (is_key_on_paper) {
            : print "You pull the paper back from underneath the door. You also take the key that is resting upon it." ;
            : pocket "key" ;
         }
         : else {
            : print "You pick up the wallpaper." ;
            : pocket "wallpaper" ;
         }
         : set_false "is_paper_under_door" ;
         : set_false "is_key_on_paper" ;
         : press_any_key ;
         : redescribe;
      }
   }
   
   : match "unlock door; open door"  {
      : if (is_carried "key") {
         : print "Using the small key, you unlock the door, open it, and continue onward to your next adventure." ;
         : press_any_key ;
         : print "Thank you for playing this trivial ROOM ESCAPE game." ;
         : end_game ;
      }
      : else {
         : print "The door is locked" ;
      }
   }
   
}

vocabulary {
   : noun / aliases = [wallpaper, paper]
}

About Adventuron Classroom

Adventuron Classroom is an game building toolkit for building text adventure games -in the browser (editor requires desktop PC). 

Ideal as a introduction to coding for 8-12 year olds, Adventuron Classroom features a full course on how to develop a full retro-style text adventure game..

It features tooling to make it easy to code, right inside the browser. 

Export the game as HTML, ready to be published on Itch or other platforms.


In addition to the built-in tutorial (aimed at children), an additional video tutorial (aimed at adults) is available here:


StatusIn development
PlatformsHTML5
Rating
(1)
AuthorAdventuron

Leave a comment

Log in with itch.io to leave a comment.