LayeredUpdates

Based on the idea (and algorithm) behind the layering part of DR0ID's FastRenderGroup. It is an extension of pygame's OrderedUpdates sprite group, to allow sprites added to a group to always be drawn either before or after other sprites in the group - regardless of the order in which they were added to the group.

Features

Download

Latest version: 1.0.0

This class is released under the LGPL.

Usage example

from pygame.sprite import Sprite
from layeredupdates import LayeredUpdates
 
grp = LayeredUpdates()
bob = Sprite()
ted = Sprite()
# Add bob and ted to the group, so that bob is always drawn on top of ted
grp.add(bob, layer=20)
grp.add(ted, layer=10)

See also

DR0ID's FastRenderGroup.