title: how to delete a shape after drawing it in pygame?
body: <p>I am making a game in pygame. I use a &quot;laser&quot; as the projectile the player shoots. I currently use a system that when a certain condition is true, I change the color of the laser to red. however, this does not work with collidirect. Collidirect immediately &quot;activates&quot; when the &quot;laser&quot; is colliding with an entity.
  The laser is drawn at the last line of my code.</p>
  <p>Here is the code:</p>
  <pre><code>import pygame
  import sys
  # Creating a loop to keep program running
      while True:
         
          # --- Event Processing and controls
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  pygame.quit()
                  sys.exit()
              elif event.type == pygame.KEYDOWN:
                  if event.key == pygame.K_RIGHT:
                      spaceship_x_change = 10
                  elif event.key == pygame.K_LEFT:
                      spaceship_x_change = -10
                  elif event.key == pygame.K_UP:
                      red = (255, 0, 0)
              elif event.type == pygame.KEYUP:
                  red = (0, 0, 0)
                  spaceship_x_change = 0
  
          spaceship_x += spaceship_x_change
  
          # Preventing the ship from going off the screen
          if spaceship_x &gt; display_width - 140:
              spaceship_x -= 10
          if spaceship_x &lt; 1:
              spaceship_x += 10
  
          pygame.draw.rect(game_display, red, [spaceship_x + 69, 70, 4, 310])
  </code></pre>