[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] LayeredDirty and DirtySprite doesn't work well with the visible flag?



Hi

your problem sounds strange... invisible sprites should not take that much to render. Maybe its an issue with the LayeredDirty.set_timing_treshold ?

Are the invisible sprites dirty? (it could help to set them invisible and not dirty at the same time)

And it is not intended to subclass LayeredDirty class, but feel free to try.

And next time, please make a new thread.

~DR0ID

Yannick Weinz schrieb:
Hi all.

I have a problem with the visible flag of the DirtySprite and the .draw() method of the LayeredDirty group.

Right now i'm at writing some kind of labyrinth game. Therefore each cell you can be on has its own class (DirtySprite). I only want to see a small radius of the map, thus using the visible flag.

The Problem is now, that when i put most of the cells to visible = 0, the draw() method of the LayeredDirty Group needs several seconds until its finished (i tested it with 100x100 Cells, means 10000 DirtySprites in my LayeredDirty group and as soon as i move, e.g. all Cells get scrollen by the length of a cell to the right direction, the .draw() method needs some seconds to compute, so before i see a result on the screen, i have to wait some seconds). The funny thing is, that if all cells are visible = 1 (default value), everything works fine (if i move the draw() method only needs ms to compute).

Is it normal that a Spirte takes much longer to be drawn when the visible flag is set to 0 or does i do something wrong?