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

[pygame] Layered Sprite Groups within Layered Sprite Groups



Hello,
Â
I'm back with another blitting / Sprite / Layer Group Issue!
Â
So, I've got a map which is on a grid (of course). This map has a layer group in it which is just the tiles. The tile sprites have a layer number (as per the DirtySprite documentation). This layer number is the Y axis of my grid (makes sense)!
Â
So, if my Tile sprite is just a DirtySprite type (http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.DirtySprite) and I draw my maps LayeredDirty group the map draws correctly, with the tiles layered on top of eachother as they should be.
Â
However, to add an extra layer of flexibility, I am trying to make layers inside the tiles too! I'm hoping to have 3 layers for each tile (Background, Decoraction and Unit). So, currently i'm trying to make a LayeredDirty group inside each tile object, where each layer in that tile is a DirtySprite (like the tile itself). Then, when the tile is dirty, ITS OWN LayeredDirty group is redrawn to the tiles image property, which in turn should then be drawn when the maps LayeredDirty group is drawn later. However, at the moment, when the next layer in the Y axis is drawn, I just get black squares and only the top half of the tile above (the layering is clearly not working correctly).
Â
Hopefully all that makes sense (its very hot here at the moment, hard to make any sense in this heat)!
Â
This link below is from some rough code I've thrown about to try and get this to work!
Â
https://docs.google.com/file/d/0B40CJaTKX9a_azdhRHg4T2V0eTQ/edit?usp=sharing
Â
Any help with this would be mega, I've been stabbing at it for about a week now!
Â
Cheers in advance