Sitemap
Peter Riesing

Peter Riesing

Press enter or click to view image in full size

“Dumpster Hero”

3 min readNov 30, 2022

--

A Python Terminal Game

Dumpster Hero is a simple game played in the terminal of your computer. Coding for the game started by defining the class for all characters, player and enemy.

Values include name(“Character Name”), type(“raccoon”etc.), health(int), attack(int), and alive (Boolean value starting as True).

Each character was given values and was instantiated to the class “Character.”

Press enter or click to view image in full size
userName accesses a player input to assign a value of their choosing

Once characters were defined, game logic was laid out. For me this meant physically drawing out how the game would play out. From title screen to naming your player to a main menu to a series of sub menus for fighting and healing to ending the game. Next I pseudo-coded the logic into a python file.

Get Peter Riesing’s stories in your inbox

Join Medium for free to get updates from this writer.

After the logic made enough sense I began forming the functions within the “Character” class. These functions included menus, damage and attack, healing, and viewing updated character stats. This proved the most difficult for me as I had trouble calling character values and adding or adjusting them.

In class functions for taking damage and checking stats

Using loops I created the game menu and healing menu navigation. “While” loops ensure the game ends if a player or enemy dies. “If” loops allow the user to choose options from those menus.

Loop for navigating “healFunc()”

Being my first major project there was much troubleshooting and debugging to get done. I also fleshed out the details of the in-game text and menus. Finally, I was able to get a (mostly) functioning game.

Title card, intro to game, Main menu
Option 1: Stats, Option 2: Fight, Option 3: Heal
Heal sub menu Option 1: Eat

Overall, this proved very difficult for me. I’m a very visual person so understanding the flow of logic was a major hurdle. I created multiple workspace files to test out concepts outside of the cluttered main game file. I was able to create a base fighting game without much trouble. I also made a working function that dealt with a healing concept. Upon combining these two concepts, I dealt with errors that arose where values would not store or cross between healing and fighting. With the help of classmates and Digital Craft instructors and teaching assistants I finally managed to get a working game.

Lastly, I couldn’t let the weird project I had made launch without a logo so I created one using Adobe Illustrator.

Here is a link to the game in my GitHub repository:

https://github.com/peterriesing/Peter---Digital-Crafts-Repo/tree/main/Code/PythonGame

Thanks for reading. Cheers!

-Peter Riesing

--

--