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

Re: [pygame] how to change layer of a sprite in LayeredDirty group ?



Hi, Horst.

If I recall correctly you can:

1. Set the sprite._layered attribute before adding sprite to the group.
2. Specify group.add(sprite, layer=n) where n is the layer.
3. Use group.change_layer(sprite, n) where n is the new layer.

Gumm

On Sun, Apr 17, 2011 at 8:43 AM, Horst JENS <horstjens@xxxxxxxxx> wrote:
Hi,
a question regarding pygame's LayeredDirty() group for sprites:

how do i set or change the layer of a sprite in this group correctly ?

At the moment (using pygame 1.9.1) i'm ony able to have the layer
reflect the point of creating the sprite (newer sprites are on top of
older sprites),
but i can not use ._layer like i could in the LayeredUpdate group.

I have also no results for using

layer

instead of

._layer

(there is a comment int hte pygame.org wiki hinting to that)

is there another trick to set / change the layer of a sprite in
LayeredDirty groups ?

greetings,
 -Horst

--
http://ThePythonGameBook.com