Chapter 8: Python packages

Example package

What better way is there to understand how packages work than to try things out yourself?

Building on from my crappy battle game from earlier, I have written a package for an epic battle game. It is not the best piece of game yet at the moment, but it is a good start!

Please download packages.zip file from this link, and unzip the file to your computer.

Browse the files and folders in the directory, and try to get a feel of the structure. Look at the content in battle/item/weapon.py, battle/character/hero.py and battle/game/manager.py. In particular, observe how the other modules are imported in battle/game/manager.py.

Now, your task is to write an import statement in main.py so that the main program actually works.

Once you are done, then run python main.py. If done correctly, you should be rewarded with an epic game battle! ⚔️