group is a container that holds objects. There is no reason to call its object, but call its objects methods .
You would do something like this
http://programarcadegames.com/index.php?...to_sprites
Quote:def newdrop(): Drop1 = pygame.sprite.Group() d = Drop1() all_sprites.add(d) drop.add(d)
You would do something like this
# This is a list of 'sprites.' Each block in the program is # added to this list. # The list is managed by a class called 'Group.' block_list = pygame.sprite.Group() # This is a list of every sprite. # All blocks and the player block as well. all_sprites_list = pygame.sprite.Group() ... for i in range(50): # This represents a block block = Block(BLACK, 20, 15) # Set a random location for the block block.rect.x = random.randrange(screen_width) block.rect.y = random.randrange(screen_height) # Add the block to the list of objects block_list.add(block) all_sprites_list.add(block) ... player = Block(RED, 20, 15) all_sprites_list.add(player)full example here
http://programarcadegames.com/index.php?...to_sprites
Recommended Tutorials: