[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Ok another question from me - Python Classes and Pygame is pretty hard to understand.



These are all very general Python questions that would come up in using classes anytime, not just with pygame.

Maybe have a look at the python tutorial section on classes:

http://docs.python.org/tut/node11.html

hth,

-Casey

On Aug 31, 2007, at 2:52 PM, Lamonte Harris wrote:

Whats the best method to understand how to use classes w/ pygame code. I seen some complex stuff like:
class Fist(pygame.sprite.Sprite):
"""moves a clenched fist on the screen, following the mouse"""
def __init__(self):
pygame.sprite.Sprite.__init__(self) #call Sprite initializerThats pretty hard to understand imho[snippet from the Chip Game] Can someone explain how the sprites work. Quick question:

class First(pygame.sprite.Sprite):

does that inherit that sprite class?  then what does the __init__ do?