The Lord's Staff is a short options based text game played in a terminal. This story "game" is coded in Python. This is my first ever coding project, and I hope anyone who plays can enjoy it :)
Gabriel Pop
Check their project out: MemeOS – A Web-Based “Operating System” Filled with Easter Eggs
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
I finally wrote the text that would print based on the currently equipped weapon that player has when they enter the shop. I fixed some minor issues, like printing the number damage as a string instead of basing the print message on a variable. I deleted the tests (since they work and are no longer needed) and added the weapon Fists
to the default bag.
I haven't updated in a while, but I fixed some minor issues with my code, began adding the decisions for choosing a path in the maze() function, began on writing the code for the ending (allowing the player to restart the game or just continue with their current stats), and created a weapon instance for the Lord's Staff (the end game weapon). I'm excited because I'm nearly done with this project!! I just need to finish the maze code, work on how the skills will work, preferred names for the player, and adding health potions.
I began to work on the labryinth and wrote some of the story for the maze. I created the function that will ask the user whether or not they are ready to enter the maze to start the game.
I changed the inputs for the purchasing()
function to be based on numbers (1 = one thing, 2 = another) instead of the name of the weapon. This makes it easier for players to select something, and makes it easier for me to code. I should've done this way earlier but I didn't realize that basing the outputs on something as case sensitive as text inputs would not be a smart idea.
My sister was interested in what I was doing, so I got her to be my first beta tester! I was glad that she could understand how to play the game, even with her non-existent coding knowledge. Hopefully other people with no coding knowledge can also understand how to play as well.
I updated my README file with some background and how I got the idea for this project. I found out that the creator of the project that I took inspiration from switched the project with another one of theirs, since they believed their newer project was more deserving of the top spot.
Despite my many attempts to make sure that the formatting of a player's input doesn't matter, I came to a disastrous conclusion. The hours I spent worrying and recoding the shop dialogue and code to remove this problem was in vain. All I had to do was assign a number to a weapon, and no matter the input, it would be interpreted the same. This is the worst realization I've ever had in my life. cries
I edited some of the print
statements to make them more story-like. This coding project is a story game, after all. Some of these print statements including some print statements that are shown in the purchasing()
function like the one that shows if you don't have enough money to purchase a weapon or the prints statements that ask you to confirm a purchase. I also added some print statements based on a player's reply.
I also changed the statement that prints a player's weapon when they check their inventory and their stats into a for loop. I didn't like how it would print something like ['Fists']
, but I forgot how to format it differently. For this I had to search it up, and the best answer was creating a for loop that printed each item in a list.
The last change I did was putting the chunks of print statements in the choose()
function into their own function. I know this isn't necessary, but it allows me to better read my code and make it feel less cluttered.
I changed multiple functions that I needed to adjust, and also created some functions to make coding the purchasing function easier. Another change was making the equip weapon function output depend on the string value of the input instead of creating a function that could translate the string input to the instance of a weapon that could be equipped by the player. The main issue with this idea I had was that I didn't know how to do it, especially since I had searched up how to and didn't even know how to explain what I wanted to do. I found that it would be way easier for me to compare the value of select
to the predetermined weapon instances/types, stick
, metal_sword
, wooden_sword
, bow
, and dragonsblade
and make each individual if
statement correspond to each weapon.
Some other things I did included using the lower()
function on certain parts of code to allow players to write their inputs a little faster. I realized that not everyone is well-versed in touch-typing (or some may not know that the code is case-sensitive), so I think doing this could help users at least a bit. Lastly, I fixed some bugs/things I forgot to code in the purchasing()
function. I somehow forgot to continue the function or at least bring the user back to the choose()
screen, so I just added the choose()
function as needed within both the choose()
function and the purchasing()
function (I love functions, if you can't tell).
This session, I edited the options function to allow players to go back to the options after selecting certain actions, and I also added an option when players don't select any of the predetermined options (aka an invalid input).
The last 3 hours of coding this project have had sooo many problems.
I have an issue of overcomplicating things when trying to solve a problem, and often times leads me to being frustrated and spending 20 hours on something that should've taken me 2. This was one of them.
I wanted to create a class for a player's inventory so that people who use this program can purchase more than one weapon and switch between weapons if they wanted to. This would be possible with an array. However, I made a class for the inventory, and despite the many google searches and Stack Overflow threads I've made and read, the class wouldn't work. After a while of struggling with this issue, I just decided that I should initialize a variable within the player class that is an array. When I figured this out, my raging headache went away and I was glad that I had finally found a solution to my hours of stress. I somehow found a way to overcomplicate how to put this feature into this game, which was all solved by adding bag = [] to my player class.
I started a devlog yesterday but didn't finish, so this text includes all the updates between yesterday and today.
I created a class for a weapon and a class for the player. Originally I didn't have an individual instance for each weapon, neither a class, but I realized that it would make adjusting the costs and damage wayyy easier. While coding the instance for each weapon, I remembered that I kept changing the costs and damage in my planning document, and also added weapons. So creating a weapon class would make adjusting the weapons way easier.
I also edited the dialogue for when the player opens the shop. I especially reformatted the text and made each sentence have its own line instead having a paragraph in one print statement. This made reading the dialogue easier to read and prevented/fixed some of the issues I had when adjusting my code.
I had to learn a bit about classes to create the weapon class. For the player class, I coded it more intuitively (class Player(): then just defining variables for the player, eg damage = 1). However, I learned that I would have to define parameters for the type of class the weapon class is. (initializing the class, self.damage, adding parameters, etc). Although I'm sort of experienced with coding, I had to learn about this a little more to make my code work.
I feel pretty good about my project so far. My next tasks include designing the maze, extending the READ.me file a LOT more, and maybe implementing more features (maybe the player can choose their name and I can put their name into dialogue).