From e819e2e46d8ae036097db64d1f94ca925887a850 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 7 May 2015 20:08:47 +0100 Subject: [PATCH] addded function to generate fireback targets --- game.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/game.py b/game.py index 41b2371..a04dfa3 100644 --- a/game.py +++ b/game.py @@ -39,15 +39,27 @@ def initialise(menu, options): return exit_code -def generate_targets(): +def generate_targets(player): group = pygame.sprite.Group() - for i in range(5): # Number of rows - i *= 25 - for j in range(50, WINDOW_SIZE[0] - 70, 30): - #logging.debug("Target generated with position ({},{})".format(j,i)) + level = Levels[player.level] + + for i in range(level.rows): + i *= level.padding + for j in range(50, WINDOW_SIZE[0] - 70, level.padding): temp = Target(x=j,y=i) + if randint(0, ) group.add(temp) - del temp + del temp + + for i in range(level.firebacks): + changed = False + while not changed: + if group[randint(0, len(group)-1)].type != "SHOOTER" + group[randint(0, len(group)-1)].type == "SHOOTER" + changed = True + else: + group[randint(0, len(group)-1)].type != "NORMAL" + return group