Thanks to some awesome suggestions from a few pioneering users, Trinket now supports neat text adventures.
Using our new add files feature Brian introduced a few days ago, a group of parents and teachers from SF Brightworks have made a text adventure game module that students can use to make their own classic adventure games:
Their code is in adventure.py and is imported, so it stays out of the way and students can focus on building the rooms and items in the game.
These games may be simple, but they’re a critical part of getting comfortable with text-based programming. Many of today’s most famous programmers started out building simple text-based games, and classics like Zork and ADVENT inspired a whole generation of programmers to use computers for creative pursuits.
Using the Trinket above, see if you can alter the text of the existing locations. Look for how the connections between locations are created and see if you can add another yourself! Find the line where the ‘key’ is added and duplicate it to add another item in the same space. Then press Run to see your changes updated in the game.
The coolest part of working at Trinket is seeing what creative things users are doing with code. Got an awesome project? Get in touch. If you’d like to help this adventure crew build their module for students, check out their github project and consider contributing!