There are a few problems that I can see. First, you shouldn't check for the enemies going off of the screen inside of
for bullet in bullet_list:
for block in block_hit_list:
you should create a new line on the main loop.
Second, every time you call
random.randrange(600)
you get a new random number inbetween 0 and 600. So the following code has a sixth of a percent chance of being ran if block is still on the screen. If block goes of the screen, it has a 0 percent chance. Instead, write
if block.rect.y >= 600:
So the whole thing should look like:
for bullet in bullet_list:
block_hit_list = pygame.sprite.spritecollide(bullet, block_list, True)
for block in block_hit_list:
explosion.play()
bullet_list.remove(bullet)
all_sprites_list.remove(bullet)
score += 10
if health >= 25 and score == 70:
win.play()
font = pygame.font.Font("freesansbold.ttf", 30)
label = font.render("LEVEL COMPLETE!", 1, (0,255,0))
labelRect = label.get_rect()
labelRect.center = (400, 250)
bullet_list.remove(bullet)
all_sprites_list.remove(bullet)
break
if score >= 70:
collision.stop()
laser.stop()
explosion.stop()
bullet_list.remove(bullet)
all_sprites_list.remove(bullet)
block_list.remove(block)
all_sprites_list.remove(block)
player_list.remove(player)
all_sprites_list.remove(player)
if health == 0:
laser.stop()
bullet_list.remove(bullet)
all_sprites_list.remove(bullet)
if bullet.rect.y < -10:
bullet_list.remove(bullet)
all_sprites_list.remove(bullet)
if block.rect.y >= 600 and health >=25 and score < 70 and score > 0:
font = pygame.font.Font("freesansbold.ttf", 30)
label = font.render("Score target not met", 1, (0,255,0))
labelRect = label.get_rect()
labelRect.center = (400, 250)
Hope that helps!