Difference between revisions of "Talk:Complete Roguelike Tutorial, using python+libtcod, part 11"

From RogueBasin
Jump to navigation Jump to search
Line 30: Line 30:


Cheers,
Cheers,
--[[User:Dontroel|Dontroel]] ([[User talk:Dontroel|talk]]) 01:03, 24 February 2013 (CET)
[[User:Dontroel|Dontroel]] ([[User talk:Dontroel|talk]]) 01:03, 24 February 2013 (CET)


:Thanks for the encouragement, and the suggestion! That's a very elegant solution. However, we can simply use the send_to_back() function, which is a bit more brittle; I just fixed it in the tutorial. In the long run I may change to your solution though, for now this will do as it's a much smaller change! [[User:Jotaf|Jotaf]] ([[User talk:Jotaf|talk]]) 06:01, 26 February 2013 (CET)
:Thanks for the encouragement, and the suggestion! That's a very elegant solution. However, we can simply use the send_to_back() function, which is a bit more brittle; I just fixed it in the tutorial. In the long run I may change to your solution though, for now this will do as it's a much smaller change! [[User:Jotaf|Jotaf]] ([[User talk:Jotaf|talk]]) 06:01, 26 February 2013 (CET)
::You're welcome! That seems very sensible to do for now. But yes, the send_to_back() function is a nice and simple solution, but it does become a bit unmanageable, if one wants a bit more control over how several objects in a single tile are rendered. [[User:Dontroel|Dontroel]] ([[User talk:Dontroel|talk]]) 22:32, 26 February 2013 (CET)

Revision as of 21:32, 26 February 2013

Just returned after a half year hiatus to find more parts of this excellent tutorial!

A minor bug/suggestion regarding stairs: Since the stairs are added last in make_map(), the < will always be drawn last (except for the player). This means that when monsters step on top of it, they "disappear".

A quick fix (avoiding introducing general z-levels) is to simply extend the special handling of the players to all fighters. In render_all() substitute the lines:

    #draw all objects in the list, except the player. we want it to
    #always appear over all other objects! so it's drawn later.
    for object in objects:
        if object != player:
            object.draw()
    player.draw()

for

    #draw all objects in the list, except the fighters (monsters and player).
    #we want those to always appear over all other objects! So they're drawn later.
    fighters = []
    for object in objects:
        if object.fighter is None:
            object.draw()
        else:
            fighters.append(object)
    for fighter in fighters:
        fighter.draw()

Cheers, Dontroel (talk) 01:03, 24 February 2013 (CET)

Thanks for the encouragement, and the suggestion! That's a very elegant solution. However, we can simply use the send_to_back() function, which is a bit more brittle; I just fixed it in the tutorial. In the long run I may change to your solution though, for now this will do as it's a much smaller change! Jotaf (talk) 06:01, 26 February 2013 (CET)
You're welcome! That seems very sensible to do for now. But yes, the send_to_back() function is a nice and simple solution, but it does become a bit unmanageable, if one wants a bit more control over how several objects in a single tile are rendered. Dontroel (talk) 22:32, 26 February 2013 (CET)