title: Problem adding explosions to space invaders
body: <p>Hi I'm new to python and as my first project decided to do a space invaders game,
  So my problem is that for each column of aliens I shoot down explosions for that column appear in the same specific place.</p>
  <p>For example explosions for the far left column appears on the top left of the screen and as you move to the columns on the right, the explosions go down, so much so that the explosion animations for the far right column appear in the bottom right of the screen.</p>
  <p>I'll include the code for the Explosions class I made and the part of the functions file in which I think I have written the code causing this problem.</p>
  <p>the explosions class:</p>
  <pre><code>import pygame
  
  
  pygame.init()
  
  clock = pygame.time.Clock()
  fps = 60
  
  
  class Explosion(pygame.sprite.Sprite):
      def __init__(self, x, y, size):
          pygame.sprite.Sprite.__init__(self)
          self.images = []
          for num in range(1, 6):
              img = pygame.image.load(f&quot;images/exp{num}.png&quot;)
              if size == 1:
                  img = pygame.transform.scale(img, (20, 20))
              if size == 2:
                  img = pygame.transform.scale(img, (40, 40))
              if size == 3:
                  img = pygame.transform.scale(img, (160, 160))
              # add the image to the list
              self.images.append(img)
          self.index = 0
          self.image = self.images[self.index]
          self.rect = self.image.get_rect()
          self.rect.center = [x, y]
          self.counter = 0
  
      def update(self):
          explosion_speed = 4
          # Update explosion animation.
          self.counter += 1
  
          if self.counter &gt;= explosion_speed and self.index &lt; len(self.images) - 1:
              self.counter = 0
              self.index += 1
              self.image = self.images[self.index]
  
          # If the animation is complete, delete explosion.
          if self.index &gt;= len(self.images) - 1 and self.counter &gt;= explosion_speed:
              self.kill()
  
  </code></pre>
  <p>the possible problematic section:</p>
  <pre><code>def check_bullet_alien_collisions(ai_settings, screen, stats, sb, ship, aliens,
                                    bullets, ai_sounds, explosions):
      &quot;&quot;&quot;Respond to bullet_alien collisions.&quot;&quot;&quot;
      # Remove the bullets that have collided.
      collisions = pygame.sprite.groupcollide(aliens, bullets, True, True)
       for alienn in collisions:
          explosion = Explosion(alienn.rect.centerx, alienn.rect.centerx, 2)
          explosions.add(explosion)
  
      if collisions:
          for alienss in collisions.values():
              stats.score += ai_settings.alien_points * len(alienss)
              ai_sounds.play_alien_explosion_sound()
          sb.prep_score()
          check_high_score(stats, sb)
      if len(aliens) == 0:
          start_new_level(ai_settings, screen, stats, sb, ship, aliens, bullets)
  
  </code></pre>