Hello! I am putting my code here to ‘finish’ the Python Terminal Game project, since it says to post it after refactoring!
The game is a basic hide-and-seek game, finding an object in a specific place. Both are determined by random at the beginning of the game. The game itself is basically a guessing game, having you make selections between the hiding places the item you’re searching for is.
TheNoodleCat/lost-n-found: A project I’m working on for the first project of Codecademy’s Computer Science Course. (github.com)
The reason I chose a text-type adventure for mine is because I love making stories. While this specific game isn’t the most story heavy though, I did include elements to give a tale of why your job looking for other’s belongings are important, mainly in the “info” option and through “talk”.
The code is comprised of three classes, each handling a different portion of the code.
Game_Control is the first class, meant to handle both the variables brought between the other classes, and also the bridge between the other two.
Selection is where most of the text-based storytelling comes in. It has both options Interact and Talk (called upon from the third class, Overlay) which give flavor text about what is missing (in Talk) and the areas where you are searching (in Interact). Interact in particular bounces back to Overlay if you find the missing item.
Overlay has about all the ASCII Art I made for the game (the only exception being the title). It bounces to and from Interact to allow the player to search objects as many times as necessary. In its “winnings” function, it displays the “You Won” screen and allows the player to start another round as well.
I learned a whole bunch more about how functions should be named for clarity, where and what will go wrong with my code, and while it hasn’t been implemented in this code specifically, my feedback gotten from those who reviewed the code taught me much more as to how to organize my code with classes. thank you for reading, and I hope you enjoy the game I created!