To change the layer of a Sprite
, simply use the change_layer
method:
change_layer()
changes the layer of the sprite
change_layer(sprite, new_layer) -> None
Question
I am making a program with sprites. I have a "box" where the sprites is going to come inside and show only inside the "box". I have tried to find how to change layers and came to this documentation on pygame.sprites, but I can't understand the codes there for changing layers. Does anyone know how I can set the sprite in the middle of the layers instead of on the top?
Solution
To change the layer of a Sprite
, simply use the change_layer
method:
change_layer()
changes the layer of the sprite
change_layer(sprite, new_layer) -> None