[Tutor] Moveable and Animated Sprites
alan.gauld at btinternet.com
Mon Aug 15 09:00:41 CEST 2011
On 15/08/11 03:09, Jordan wrote:
> Is there a more Pythonic way to create the class
> "MoveableAnimatedSheetSprite" I am using multiple inheritance but I see
> that I am really loading the image twice when I call __init__ for
> "AnimatedSheetSprite" and "MoveableSprite". Should I just make a
> moveable class and have moveable items inherit it with out inheriting
> from "Sprite"?
This is really more a pyGame question than a Python one so you will
probably get a better response posting on the PyGame forum.
However there are a few pyGamers here so you might get lucky...
> class Sprite(pygame.sprite.Sprite):
> def __init__(self, imageName, startx=0, starty=0):
> def update(self):
If you are just calling the superclass you don't need this method.
But I assume you will be adding extra content later? If not, your
subclasses can still call Sprite.update() without this definition being
Beyond that I can't add much...
Author of the Learn to Program web site
More information about the Tutor