The other thing that helps with understanding code is adding in some comments. Comments are text that the computer doesn't recognise as code, but which instead is for humans to read if they are looking at the code. In Python, everything after an octothorp (sometimes called a "hashtag": "#") is a comment. So, for example, we can add comments both before and after code:
#Section of code dealing with fighting.
ogre_strength = 2 #Strength set low to help player.
This kind of thing really helps when you come back to look at code after a couple of weeks. Ideally about 50% of your program should be code, 25% whitespace, and 25% comments.
Make your code as clear as possible using whitespace and comments, and then save it. You should now be able to add some extra interest to your own game. Try adding in some non-player characters (they don't have to be monsters) and some randomised interactions with them (it doesn't have to be fighting - it could be them randomly giving you treasure or information). Don't forget to comment your own code!
As our code is now getting quite long and complicated, in the next part we'll look at how to make our own functions - this will really help simplify our code.
[Home > Part 2 > Part 3]