###################################################################################### ########################################################## ## ADVENTURE GAME STARTS HERE ########################################################## import random from adventure import * # start by creating the game system game = Game("Brightworks Adventure") # define and describe a couple of locations sidewalk = game.new_location( "Sidewalk", """There is a large glass door to the west. The sign says 'Come In!'""") vestibule = game.new_location( "Vestibule", """A small area at the bottom of a flight of stairs. There is a glass door to the east, and door to the west. To the north there is a dark muddy hole.""") office = game.new_location( "Office", """A nicely organized office. There is a door to the south.""") tunnel = game.new_location( "Tunnel", """A dark and moist muddy hole that might lead somewhere...""") game.new_connection("Glass Door", sidewalk, vestibule, [IN, WEST], [OUT, EAST]) game.new_connection("Office Door", vestibule, office, [IN, WEST], [OUT, EAST]) game.new_connection("Tunnel Opening", vestibule, tunnel, [DOWN, NORTH], [UP, SOUTH]) # Now let's add a thing, a key, by providing a single word name and a longer # description. We will create the key at the sidewalk. key = sidewalk.new_object("key", "a small tarnished key") # And we can make the key required to open the office office.make_requirement(key) # Let's add a special phrase. We can attach this phrase to any object, location or actor, # and the phrase will trigger only if that object or actor is present or at the given location. key.add_phrase("rub key", game.say("You rub the key, but fail to shine it.")) player = game.new_player(sidewalk) game.run() ###########################################################################################
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question