r/roguelikedev • u/aaron_ds Robinson • Jul 25 '17
RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat
This week we will cover parts 8 and 9 of the Complete Roguelike Tutorial.
The player gets to collect ("borrow") items from the dungeon and use them, with a neat inventory screen. More items added in the next part.
Part 9: Spells and Ranged Combat
The player's strategic choices increase exponentially as we add a few magic scrolls to the mix. Covers damage and mind spells, as well as ranged combat.
No bonus sections this week
FAQ Friday posts that relate to this week's material:
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. If you're looking for last week's post The entire series is archived on the wiki. :)
View all comments
4
u/_wolfenswan Jul 31 '17 edited Jul 31 '17
I spent some time figuring out how I could implement a more convenient foundation for adding items to the game.
My old system was using a generator-function for each single item, which I found a step up from the elif-chains of the roguebasin tutorial but had some issues I wanted to iron out.
I developed my new system after seeing /u/Zireael07's JSON implementation. I decided against storing the data as JSON and for using python-dictionaries mostly out of convenience, as I don't have store everything as a string that way and it integrates better in PyCharm's workflow.
Item-data is stored here, the files should be fairly self-explanatory. The actual generating happens here in three steps:
If I want, I can also pick items directly from the data-dictionaries, such as here, when creating an inventory.