Skip to content Skip to sidebar Skip to footer

Space Invaders - Pygame - Attributeerror

I want to make the enemies shoot, firstly with the tab butten, after I get this working I want to make them shoot randomly. When I press the tab button it says AttributeError: 'Gro

Solution 1:

Change the line:

enemy.shoot()

to

random.choice(enemy.sprites()).shoot()

This will call the shoot() method of a random sprite from your SpriteGroupenemy.

Post a Comment for "Space Invaders - Pygame - Attributeerror"