title: Get the position of the collided sprite
body: <p>I need to get the position of the last sprite that collided between 2 groups. All the sprites in a group have the same name. here is the concentrate code:</p>
  
  <pre><code>    rmog = pygame.sprite.Group()
      rmg = pygame.sprite.Group()
  
  
      class rmissileh(pygame.sprite.Sprite):
  
          def __init__(self, image, speed):
               pygame.sprite.Sprite.__init__(self)
               self.speed = -10
               self.speedx = 0
               self.image = redm
               self.rect = image.get_rect().move(s.rect.x+26,s.rect.y)
  
  
          def move(self):
  
               self.rect = self.rect.move(self.speedx, self.speed)redshot = 
  
  rmissileh(redm, -10 )
  rmg.add(redshot)
  
  
      class crmonstre(pygame.sprite.Sprite):
          def __init__(self, image, speed):
              pygame.sprite.Sprite.__init__(self)
  
  
              self.speedy = 2
              self.speedx = 1
              self.image = rmonstre
              self.step = 600
              self.rect = rmonstre.get_rect().move(500,-100)
          def move(self):
              self.rect = self.rect.move(self.speedx,self.speedy)
  
  redmonstre = crmonstre(rmonstre,1)
  rmog.add(redmonstre)
  redmonstre = crmonstre(rmonstre,1)
  rmog.add(redmonstre)
  redmonstre = crmonstre(rmonstre,1)# I added only three but there is many more overtime.
  rmog.add(redmonstre)
  while stop:
  
              for event in pygame.event.get():
                  if event.type ==pygame.QUIT:
                      stop = False
              for redmonstre in rmog:
                  fenetre.blit(fond, redmonstre.rect, redmonstre.rect)
                  redmonstre.move()
                  fenetre.blit(redmonstre.image,redmonstre.rect)
  
              if pygame.sprite.groupcollide(rmg, rmog,True ,True):
                  fenetre.blit(fond, (0,0))
              pygame.display.update()
  pygame.quit()
  quit
  </code></pre>
  
  <p>As you can see when a redmonster collide with a redshot i have to blit the whole background(named "fond") because i don't know his position, if I print(redmonstre.rect.x) that will print the x position of the last object that i created and not the position of the one that collided.
  And also in the while loop to blit a moving object i do : </p>
  
  <pre><code>for redmonstre in rmog:
      fenetre.blit(fond, redmonstre.rect, redmonstre.rect)
      redmonstre.move()
      fenetre.blit(redmonstre.image,redmonstre.rect)
  </code></pre>
  
  <p>i have many many for loop like that in my code and it doesn't feel right if you have an other way to do it please let me know.</p>