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

Re: [pygame] sprite engine



Peter Shinners wrote:
On Fri, 2006-04-28 at 05:57 -0700, Kamilche wrote:
 > This can also only be used when sprites are not overlapping.

Uh, not so! If I have a background, then a tree, then a ghost in front of the tree that's translucent, and something about the tree changes...

Yes, that would work. So you draw all sprites every frame, but only build dirty rectangles for the ones that are marked dirty.



Not exactly... I CHECK all sprites every time (in the correct back to front order) to see if they intersect the dirty rectangle, and if they do, draw them. Checking for intersection is a lot faster than drawing.

--Cindy