title: How to delete a sprite at collision in a TDS game pygame
body: <p>I simply just want to delete the zombie sprite from my sprite group when the bullet collides with the zombie to create the sense the zombie is dying.
  I already tried the <code>Zombie(1,1).kill()</code> but it did not work unfortunatley.
  here is my code if it will be helpful...</p>
  <pre><code>import pygame
  from sys import exit
  from random import randint
  import math
  from pygame.math import Vector2
  from pygame.constants import K_LSHIFT, K_SPACE, MOUSEBUTTONDOWN, MOUSEBUTTONUP, K_e
  pygame.init()
  import time
  pygame.mouse.set_visible(True)
  
  
  
  
  class Player(pygame.sprite.Sprite):
      def __init__(self, x , y):
          super().__init__()
          self.x = x
          self.y = y
          self.image = pygame.image.load('graphics/Robot 1/robot1_gun.png').convert_alpha()
          self.rect = self.image.get_rect()
          self.orig_image = pygame.image.load('graphics/Robot 1/robot1_gun.png').convert_alpha()
          self.rotate_vel = 1
          self.cross_image = pygame.image.load('graphics/crosshair049.png')
          
  
      def draw(self, surface):
          &quot;&quot;&quot; Draw on surface &quot;&quot;&quot;
          # blit yourself at your current position
          surface.blit(self.image, self.rect)
          dir_vec = pygame.math.Vector2()
          dir_vec.from_polar((180, -self.rotate_vel))
          cross_pos = dir_vec + self.rect.center
          cross_x, cross_y = round(cross_pos.x), round(cross_pos.y)
          surface.blit(self.cross_image,  self.cross_image.get_rect(center = (cross_x, cross_y)))
          
  
      def movement(self):
          key = pygame.key.get_pressed()
          self.rect = self.image.get_rect(center = (self.x, self.y))
          dist = 3 # distance moved in 1 frame, try changing it to 5
          if key[pygame.K_DOWN] or key[pygame.K_s]: # down key
              self.y += dist # move down
          elif key[pygame.K_UP] or key[pygame.K_w]: # up key
              self.y -= dist # move up
          if key[pygame.K_RIGHT] or key[pygame.K_d]: # right key
              self.x += dist # move right
          elif key[pygame.K_LEFT] or key[pygame.K_a]: # left key
              self.x -= dist # move left
  
  
      def rotate(self, surface):
  
          keys = pygame.key.get_pressed()
          if keys[K_LSHIFT]:
              self.rotate_vel += 5
              self.image = pygame.transform.rotate(self.orig_image, self.rotate_vel)
              self.rect = self.image.get_rect(center=self.rect.center)
              surface.blit(self.image, self.rect)
          if keys[K_SPACE]:
              self.rotate_vel += -5
              self.image = pygame.transform.rotate(self.orig_image, self.rotate_vel)
              self.rect = self.image.get_rect(center=self.rect.center)
              surface.blit(self.image, self.rect)
  
  
      def update(self):
          self.movement()
          self.draw(screen)
          self.rotate(screen)
  
  
  
  class Bullet(pygame.sprite.Sprite):
      def __init__(self, pos, angle):
          super().__init__()
          self.image = pygame.image.load('graphics/weapons/bullets/default_bullet.png')
          self.image = pygame.transform.rotate(self.image, angle)
          self.rect = self.image.get_rect(center = pos)
          self.speed = 25
          self.pos = pos
          self.dir_vec = pygame.math.Vector2()
          self.dir_vec.from_polar((self.speed, -angle))
  
  
      def update(self, screen):
          self.pos += self.dir_vec
          self.rect.center = round(self.pos.x), round(self.pos.y)
  
  
  
  class Zombie(pygame.sprite.Sprite):
      def __init__(self, x , y):
          super().__init__()
          self.x = x
          self.y = y
          self.image = pygame.image.load('graphics/zombie/zoimbie1_hold.png').convert_alpha()
          self.rect = self.image.get_rect(center = (x,y))
          self.orig_image = pygame.image.load('graphics/Robot 1/robot1_gun.png').convert_alpha()
  
      def draw(self, surface):
          surface.blit(self.image, self.rect)
  
      def update(self):
          self.draw(screen)
  
  
  
  #screen
  clock = pygame.time.Clock()
  FPS = 60
  screen = pygame.display.set_mode((1200, 600))
  
  #player
  player_sprite = Player(600, 300)
  player = pygame.sprite.GroupSingle()
  player.add(player_sprite)
  
  #bullet
  bullet_group = pygame.sprite.Group()
  
  
  #Zombie
  zombie_sprite = Zombie(600, 300)
  zombie = pygame.sprite.Group()
  zombie.add(zombie_sprite)
  #keys
  keys = pygame.key.get_pressed()
  
  
  running = True
  while running:
  
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              pygame.quit()
              exit()
  
          if event.type == pygame.MOUSEBUTTONDOWN:
              if event.button == 1:
                      pos = player_sprite.rect.center
                      new_bullet = Bullet(pos, player_sprite.rotate_vel)
                      bullet_group.add(new_bullet)
  
                     
                      
  
  
      if pygame.sprite.spritecollide(zombie_sprite,bullet_group , True):
                  Zombie(1,1).kill()
                  
  
      bullet_group.update(screen)
      #screen
      screen.fill('grey')
      #player sprite funtions
      player.update() 
      #buller group draw
      bullet_group.draw(screen)
      bullet_group.update(screen) 
      #Zombie update
      zombie.update()  
  
      clock.tick(FPS)
  
      pygame.display.update()
  </code></pre>