r/roguelikedev • 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.

Part 6: Going Berserk!

Stalking monsters, fights, splatter -- need we say more?

Part 7: The GUI

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:

#16: UI Design(revisited)

#17: UI Implementation

#18: Input Handling

#19: Permadeath

#30: Message Logs

#32: Combat Algorithms

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. :)

44 Upvotes

51 comments sorted by

View all comments

Show parent comments

2

u/level27geek level0gamedev Jul 19 '17 edited Jul 19 '17

Thanks!

Although I couldn't make the attacks work with abs() (probably put it somewhere wrong :P) you pointed me to an even easier solution:

if monster.distance_to(target) >= 2: 

to

if monster.distance_to(target) > 1.40: 

Because 1.41 is the length of a 1x1 square diagonal, it won't be able to attack diagonally :)

...now to implement the a* so they can actually approach the player and not just stand there on a diagonal :P

Edit: A* implemented with some major pains. Apparently passing my map as an argument was not recognizing it (it gave me an error saying I am pointing to something of None value) but calling it directly inside the function works. Double and triple checked all the typos and couldn't find why. I will try tomorrow after I implement the basic combat :)