yeah, similar to static variables. They are shared between all instances of that class.
On Dec 12, 2007 12:00 PM, Gabriel Hasbun <[EMAIL PROTECTED]> wrote: > Hello, > > The piman's tutorial on sprites: > > http://kai.vm.bytemark.co.uk/~piman/writing/sprite-tutorial.shtml > > class MySprite(pygame.sprite.Sprite): > image = None > > def __init__(self): > pygame.sprite.Sprite.__init__(self) > > if MySprite.image is None: > # This is the first time this class has been instantiated. > # So, load the image for this and all subsequence instances. > MySprite.image = pygame.image.load("image.png") > > self.image = MySprite.image > Refers to MySprite.image , as variable common to all instances, I guess, > somewhat a static member in C++, Am I right? > > This is more of a python question, I went through the docs but found nothing > related. > > Thanks in advance. > >
