1
Fork 0

added option for powerups, and implemented speed

This commit is contained in:
Jake Howard 2015-05-07 22:12:16 +01:00
parent b43a2b32b3
commit d1a5e2c0e5
2 changed files with 11 additions and 8 deletions

View file

@ -29,8 +29,9 @@ class Textures():
return pygame.image.load(filename) return pygame.image.load(filename)
Level_Template = namedtuple('Level_Template', (rows, padding, firebacks)) Level_Template = namedtuple('Level_Template', ("rows", "padding", "firebacks", "powerups"))
Levels = [ Levels = [
Level_Template(2, 30, 0), Level_Template(2, 30, 0, 0),
Level_Template(3, 15, 0) Level_Template(3, 15, 0, 0),
] Level_Template(3, 20, 2, 0)
]

10
game.py
View file

@ -54,12 +54,14 @@ def generate_targets(player):
for i in range(level.firebacks): for i in range(level.firebacks):
changed = False changed = False
while not changed: while not changed:
if group[randint(0, len(group)-1)].type != "SHOOTER" index = randint(0, len(group)-1)
group[randint(0, len(group)-1)].type == "SHOOTER" 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 changed = True
else: else:
group[randint(0, len(group)-1)].type != "NORMAL" group[randint(0, len(group)-1)].type == "NORMAL"
return group return group