From d1a5e2c0e5edec8f5c38528132f2eac7bc438337 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 7 May 2015 22:12:16 +0100 Subject: [PATCH] added option for powerups, and implemented speed --- assets.py | 9 +++++---- game.py | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/assets.py b/assets.py index 5fb2f6c..9971a94 100644 --- a/assets.py +++ b/assets.py @@ -29,8 +29,9 @@ class Textures(): return pygame.image.load(filename) -Level_Template = namedtuple('Level_Template', (rows, padding, firebacks)) +Level_Template = namedtuple('Level_Template', ("rows", "padding", "firebacks", "powerups")) Levels = [ - Level_Template(2, 30, 0), - Level_Template(3, 15, 0) -] \ No newline at end of file + Level_Template(2, 30, 0, 0), + Level_Template(3, 15, 0, 0), + Level_Template(3, 20, 2, 0) +] diff --git a/game.py b/game.py index 020a8b6..f510aed 100644 --- a/game.py +++ b/game.py @@ -54,12 +54,14 @@ def generate_targets(player): 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" + index = randint(0, len(group)-1) + if group[index].type != "SHOOTER" + group[index].type == "SHOOTER" + group[index].image.fill((150,0,30)) + group[index].rect = group[image].image.get_rect() changed = True else: - group[randint(0, len(group)-1)].type != "NORMAL" - + group[randint(0, len(group)-1)].type == "NORMAL" return group