how can I make a for loop to repeat some sort of loop in itself?
this is the class:
class Target(pygame.sprite.Sprite):
def __init__(self,piture_path,pos_x,pos_y):
super().__init__()
self.image = pygame.image.load(piture_path)
self.rect = self.image.get_rect()
self.rect.center = [pos_x,pos_y]
this is the block to create the random targets:
target_group = pygame.sprite.Group()
for target in range(20):
new_target = Target("target.png",
random.randrange(0,screen_width),random.randrange(0,screen_height))
arget_group.add(new_target)
this block of code creates a set of targets to shoot, my goal is to If all the targets are down create a new set of targets creating a loop if possible.
ps. sorry new to pygame and python.