Forum Archive

Scene Module Layers introduction

Drizzel

Hey guys,
I need some help to understand the layers system in the scene module. As the name suggests, I should be able to assign different sprites to different layers so that they overlap in the correct way. Can anyone give me a quick introduction to this? Doesn't have to be detailed, I just need to know how to create a layer, assign sprites to it, and then how to delete a layer again.

Thanks al lot,
Drizzel

Auer

I'm not very experienced but i assume you would just append them to a list and make sure they all have the same sprite.z_position =? value then if you want to delete the layer just do

for item in layer:
    item.remove_from_parent()

Drizzel

Great thanks, that one part already done :)
Do you know how I can assign a spritenode to a layer?
I'm not really experienced in this either

JonB

Layers really are not required anymore -- this used to be a way to move groups of items together, but with spritenodes you can do the same by assigning as a child of another Node.

If you just want to get the stacking order, use SpriteNode's z_position.