[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] RenderUpdates.clear() bug
I was saying earlier on IRC that
"I would think RenderUpdates should be smart enough such that if a
sprite is removed from it, it clears that rectangle on clear()"
So I took a look at the code, and it looks like it INTENDS to do that,
but it doesn't work.
here's what I'm doing:
mySprite.kill() #removes the sprite, but myGroup keeps track of it in
#myGroup.lostsprites
myGroup.clear() #clears the sprite off the IN-MEMORY surface, but not
#off the screen. Also removes the sprite from
#myGroup.lostsprites
myGroup.update()
rects = myGroup.draw() #rects doesn't include the rectangle for mySprite
pygame.display.update( rects ) #so we don't ACTUALLY clear it
Now, there's two ways I can see around this:
1 - add a RenderUpdates.clear() method exactly like RenderClear, except
it doesn't empty self.lostsprites
2 - make sure a sprite's kill method is ONLY EVER called from it's own
update method
Thoughts?
--
+-------------------------------------------------------------+
| Shandy Brown Digital Thinkery |
| shandy@geeky.net http://www.digitalthinkery.com |
+-------------------------------------------------------------+
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org