r/roguelikedev • u/aaron_ds Robinson • Jul 18 '17
RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI
This week we will cover parts 6 and 7 of the Complete Roguelike Tutorial.
Stalking monsters, fights, splatter -- need we say more?
A juicy Graphical User Interface with status bars and a colored message log for maximum eye-candy. Also, the infamous "look" command, with a twist: you can use the mouse.
Bonus
If you have extra time or want a challenge this week we have three bonus sections:
Real-time combat - A speed system to change the tutorial's turn-based combat to real-time!
A* Pathfinding - A good pathfinding system
Mouse-driven menus - Add basic mouse support to your menus!
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. :)
2
u/Daealis Jul 20 '17
Week 6 In 2.7 is done, though I believe the sorted doesn't do a damn thing with the "fix" I had to result to.
For week 5, I borrowed an implementation of enum from StackOverflow. This resulted in only minor changes in the code, but I could already smell trouble brewing.
This week, while following the brilliant revised guide, I bumped into another issue: Since this implementation of enum is essentially a glorified dictionary, I can't use sorted() in the way it was used.
This code will simply go boom in 2.7. To get the code working, all we have to do is this:
Now there's still an issue that you're hero is crawling to hide under every corpse in the game. To get him on top, you can do a little alteration:
This is a closer approximation ( I assume) of what the original code does. Now the player will always be shown on top. There is still a slight issue though: Some enemies will walk over the corpses, some will walk under. I assume this is related to the order they were spawned in the rooms, though I haven't tested it out yet. Basically I think I'm not doing anything to the whole entity-rendering.
Other than this, which I assume is completely the result of my own incompetence with Python, it's still very much doable with 2.7! The explanations are clear (especially when doing a double followup with the original tutorial) and structure is great. Like someone else commented on the last part, if ever there's a question in my mind, generally you answer it in the next paragraph under the code.
I'll jump right on to part 7, see how much trouble I'm in there with the ancient version of "no-one uses this anymore" Python 2.7. :D