I am a beginner for pygame and I am imitating the game code "alien invasion" in the book "Python Crash Course" to program a game named "Alphabet zoo
The method blitme
doesn't exist in pygame.sprite.Group. You cannot invoke a method on a pygame.sprite.Group object, that doesn't exist. But you don't need blitme
at all. All you have to do is to invoke pygame.sprite.Group.draw():
Draws the contained Sprites to the Surface argument. This uses the
Sprite.image
attribute for the source surface, andSprite.rect
for the position.
For instance:
letters.draw()
pygame.sprite.Group.draw() and pygame.sprite.Group.update() are methods which are provided by pygame.sprite.Group
. The former delegates the to the update
mehtod of the contained pygame.sprite.Sprites - you have to implement the method. The later uses the image
and rect
attributes of the contained pygame.sprite.Sprite
s to draw the objects - you have to ensure that the pygame.sprite.Sprite
s have the required attributes.