0

I'm following a tutorial on making a roguelike in python, and it's actually coming along pretty nice. 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.

Thanks.

Appleshell
  • 7,088
  • 6
  • 47
  • 96
Jeremy Darrach
  • 273
  • 1
  • 6
  • 18
  • 4
    If you don't show us your code, how can we possibly guess what you're doing wrong? (Ideally give us an [SSCCE](http://sscce.org), not your whole program.) Also, it would help if you linked to the tutorial and told us what step you're on. – abarnert Mar 08 '13 at 01:29
  • Sorry, I should have elaborated. Here is the link to the tutorial: http://roguebasin.roguelikedevelopment.org/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod – Jeremy Darrach Mar 08 '13 at 01:34
  • Here is a link to the render code, which displays everything: http://www.pasteall.org/40286/python . I went through this, but I can't figure out why there is still a background. Hope this helps a bit more. Thanks – Jeremy Darrach Mar 08 '13 at 01:41

2 Answers2

0

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()

Abalieno
  • 159
  • 1
  • 1
  • 5
  • I don't know what you mean by set the background flag, but I tried overriding the background when characters are printed, and it still has the black background. I tried using:`libtcod.console_set_default_background(con,libtcod.BKGND_NONE)` as well as:`libtcod.console_set_char_background(con,x,y,libtcod.BKGND_NONE,libtcod.BKGND_SET)` in the draw methods. I'm not really sure why, or where, the backgrounds are still being drawn. – Jeremy Darrach Mar 08 '13 at 20:41
0

[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.

Thanks to everyone who replied and gave their input!

Jeremy Darrach
  • 273
  • 1
  • 6
  • 18