Member-only story
Python RPG (Part 2)
How to create your own text-based RPG in Python using Object Oriented Programming.
Here’s the link to part 1 if you want to code the game from scratch. If you want to skip the tutorial and go straight to the code and read it, here’s the project on GitHub!
By the end of this series of articles, you’ll be able to create something like this:

If you have any improvements on the code or any suggestions, please let me know. Have fun and enjoy the article!
In the following article I’ll be covering the:
- Enemy Generator
- Enemy Attack
Step 3: Enemy Generator
Enemy Name Generator
The enemy generator works like any other function in Python. The function will take “levelBoss” as an argument. This boolean variable will let us know if the enemy we are creating is a boss (True) or a common enemy (False).
To give a name to our monster we have different txt files which are just text files:
- adjective.txt