From 47464b7428948acc60e32872f4b8479962e749a0 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 8 May 2015 10:19:43 +0100 Subject: [PATCH] added random levels once level list is out --- game.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game.py b/game.py index 65ea67d..6359b5a 100644 --- a/game.py +++ b/game.py @@ -4,7 +4,7 @@ from random import randint import bullet, player, textures from bullet import Bullet from player import Shooter -from assets import Textures, Levels +from assets import Textures, Levels, generate_random_level from target import Target @@ -41,7 +41,9 @@ def initialise(menu, options): def generate_targets(player): group = pygame.sprite.Group() - level = Levels[player.level] + if player.level > len(Levels)-1: + level = generate_random_level() + else: level = Levels[player.level] for i in range(level.rows): i *= level.padding