title: Why can't my enemy healthbar shrink after it collides with a bullet?
body: <p>So I am currently making a game where the hotdog shoots bullets that should damage the Enemy. But after the bullet-enemy collision, The red healthbar that signifies its health does not shrink at all. Any tips on how to fix this? Thanks in advance.</p>
  <pre><code>import pygame
  import random
  import math
  
  # Screen parameters
  pygame.init()
  screen = pygame.display.set_mode((640, 480))
  pygame.display.set_caption(&quot;SPPACCE&quot;)
  bg = pygame.image.load(&quot;bg.png&quot;)
  font = pygame.font.SysFont('comicsans', 30, True)
  clock = pygame.time.Clock()
  score = 0
  
  # Player parameters
  class Player(object):
      def __init__(self, x, y, height, width):
          self.x = x
          self.y = y
          self.height = height
          self.width = width
          self.player_vel = 5
  
      def draw(self, screen):
          screen.blit(player_char, (self.x, self.y))
         
  
  # Enemy parameters
  class Enemy(object):
      def __init__(self, x, y, height, width, end):
          self.x = x
          self.y = y
          self.height = height
          self.width = width
          self.enemy_vel = 1.5
          self.end = end   
          self.path = [self.x, self.end]
          self.hitbox = (self.x + 17, self.y + 2, 65, 65)
          self.health = 10
          self.visible = True
  
  
      def draw(self, screen):
          self.move()
          if self.visible:
              self.hitbox = (self.x + 0, self.y, 65, 65)
              pygame.draw.rect(screen, (255, 0, 0), self.hitbox, 2)
              screen.blit(enemy_char, (self.x, self.y))
  
              # Health bars
              pygame.draw.rect(screen, (0, 0, 0), (self.hitbox[0], self.hitbox[1] - 20, 65, 10))
              pygame.draw.rect(screen, (255, 0, 0), (self.hitbox[0], self.hitbox[1] - 20, 65 - (6.5 * (10 - self.health)), 10))            
      
      def move(self):
          if self.enemy_vel &gt; 0:
              if self.x &lt; self.path[1] + self.enemy_vel:
                  self.x += self.enemy_vel
              else:
                  self.enemy_vel = self.enemy_vel * -1
                  self.x += self.enemy_vel
          else:
              if self.x &gt; self.path[0] - self.enemy_vel:
                  self.x += self.enemy_vel
              else:
                  self.enemy_vel = self.enemy_vel * -1
                  self.x += self.enemy_vel
  
      def hit(self):
          if self.health &gt; 0:
              self.health -= 1
          else: 
              self.visible = False
  
                  
  # Player Projectile parameters
  class Projectile(object):
      def __init__(self, x, y, color, radius):
          self.x = x
          self.y = y
          self.color = color
          self.radius = radius
          self.vel = 12.5
      
      def draw(self, screen):
          pygame.draw.circle(screen, self.color, (self.x, self.y), self.radius)
  
  # Images
  player_char = pygame.image.load('sprites/hotdog.png')
  enemy_char = pygame.image.load('sprites/hamburger.png')
  
  def blit(): # This draws the sprites
      player.draw(screen)
      enemy.draw(screen)
      for projectile in projectiles:
          projectile.draw(screen)
      score_text = font.render(&quot;Score: &quot; + str(score), 1, (0, 109, 255))
      version = font.render(&quot;Version 01 &quot;, 1, (51, 153, 255))
      screen.blit(score_text, (0, 0))
      screen.blit(version, (520, 0))
  
  
  shootloop = 0
  
  if shootloop &gt; 0:
      shootloop += 1
  if shootloop &gt; 2:
      shootloop = 0
  
  player = Player(300, 400, 64, 64) 
  enemy = Enemy(random.randint(10, 100), random.randint(20, 100), 64, 64, 480)
  projectiles = []
  run = True
  
  
  while run:
      clock.tick(60)
      screen.fill((0, 0, 0))
      screen.blit(bg, (0, 0))
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              run = False
  
      # Movement keys with playeborders
      keys = pygame.key.get_pressed()
      if keys[pygame.K_s] and player.y &lt; 480 - player.height - player.player_vel:
          player.y += player.player_vel
      if keys[pygame.K_w] and player.y &gt; 280:
          player.y -= player.player_vel
      if keys[pygame.K_d] and player.x &lt; 640 - player.width - player.player_vel:
          player.x += player.player_vel
      if keys[pygame.K_a] and player.x &gt; player.player_vel:
          player.x -= player.player_vel
      
      for projectile in projectiles:
          if projectile.y - projectile.radius &lt; enemy.hitbox[1] + enemy.hitbox[3] and projectile.y + projectile.radius &gt; enemy.hitbox[1]:
              if projectile.x + projectile.radius &gt; enemy.hitbox[0] and projectile.x - projectile.radius &lt; enemy.hitbox[0] + enemy.hitbox[2]:
                  score += 1
                  projectiles.pop(projectiles.index(projectile))
                  
  
          if projectile.y &lt; 640 and projectile.y &gt; 0:
              enemy.hit
              projectile.y -= projectile.vel
              
          else:
              projectiles.pop(projectiles.index(projectile))
      
      # Player shooting
      if keys[pygame.K_SPACE] and shootloop == 0:
          if len(projectiles) &lt; 1:
              projectiles.append(Projectile(round(player.x + player.width //2), 
              round(player.y + player.height //2), [255, 150, 0], 7))
      
      blit()
      pygame.display.update()
  </code></pre>
  <p>I followed TechwithTim's tutorial by the way. Also, I think this is enough to run the code.</p>