Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirtySprite subclass allow other _layer values #540

Merged
merged 1 commit into from Oct 2, 2018
Merged

Conversation

@dtschirmer
Copy link
Contributor

@dtschirmer dtschirmer commented Sep 18, 2018

See: #364
When subclassing DirtySprite _layer can be set to different values.

See: pygame#364
When subclassing DirtySprite _layer can be set to different values.
@@ -256,7 +256,8 @@ def __init__(self, *groups):
self.blendmode = 0 # pygame 1.8, referred to as special_flags in
# the documentation of Surface.blit
self._visible = 1
self._layer = 0 # READ ONLY by LayeredUpdates or LayeredDirty
self._layer = getattr(self, '_layer', 0) # Default 0 unless
# initialized differently.
Copy link

@e1000 e1000 Sep 19, 2018

If it should be possible to define _layer by the user at instantiation of the DirtySprite (or any subclass), then imho, we should do :

class DirtySprite(Sprite):

    def __init__(self, *groups, layer=0):
        ...
        self._layer = layer

And update the documentation of the constructor.
So it clearer, saves one line, and some nice cases, you won't even need an extra subclass...

@illume
Copy link
Member

@illume illume commented Oct 2, 2018

Thanks for the fix :)

@illume illume merged commit 96edef0 into pygame:master Oct 2, 2018
2 checks passed
@illume illume mentioned this pull request Oct 16, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants