简体   繁体   English

Python Roguelike:背景问题

[英]Python Roguelike: Background Issue

I'm following a tutorial on making a roguelike in python, and it's actually coming along pretty nice. 我正在跟踪有关在python中制作roguelike的教程,实际上它的进展非常好。 However, I have come to a small graphical issue: for the player and enemies, they all have a black background on them, which I don't want. 但是,我遇到了一个很小的图形问题:对于玩家和敌人,他们身上都有黑色背景,这是我所不希望的。 I've tried changing the background to none anywhere I can, but I can't seem to figure out how to fix it. 我尝试过尽可能将背景更改为无,但我似乎无法弄清楚如何解决它。 I'd really appreciate if anyone could help me out with this. 如果有人可以帮助我,我将非常感激。 Below is a link to an image showing this problem: 以下是显示此问题的图像的链接:

Also, if it helps, I'm using notepad++ and libtcod. 另外,如果有帮助,我正在使用notepad ++和libtcod。

Thanks. 谢谢。

Hmm, you probably need to set the background flag. 嗯,您可能需要设置背景标记。 Or at least give it the proper color. 或至少给它适当的颜色。 So try to override it. 因此,请尝试覆盖它。

When you print a character it needs both foreground and background. 当您打印字符时,它既需要前景,又需要背景。

In any case you should probably look into object.draw() player.draw() 无论如何,您可能应该研究object.draw()player.draw()

[SOLVED] [解决了]

I found that I overlooked one of the parameters in the object.clear() event, and all I had to do was check if the object was visible, and if it has been explored yet to determine which background color to set it to. 我发现我忽略了object.clear()事件中的参数之一,而我要做的就是检查对象是否可见,以及是否已经探索过该对象以确定将其设置为哪种背景色。

Thanks to everyone who replied and gave their input! 感谢所有回答并提供意见的人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM