From 45f42770dbe394fd183f1a4e316f137d45c400ef Mon Sep 17 00:00:00 2001 From: Miron Date: Sun, 18 Apr 2021 17:53:18 +0200 Subject: [PATCH] Change in generate package --- src/main.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main.py b/src/main.py index a25e64e..1513a20 100644 --- a/src/main.py +++ b/src/main.py @@ -15,16 +15,11 @@ DOCK = pygame.transform.scale(pygame.image.load('img/dock_left.png'), (75, 75)) def generate_package(a, b): - y = random.randint(1, 4) - x = random.randint(10, 150) - if y == 1: - p1 = Package((a, b), x, "Grocery", 'img/package_grocery.png') - elif y == 2: - p1 = Package((a, b), x, "Explosive", 'img/package_explosive.png') - elif y == 3: - p1 = Package((a, b), x, "Electronic", 'img/package.png') - elif y == 4: - p1 = Package((a, b), x, "Builders", 'img/package_builders.png') + rand_y = random.randint(1, 4) + rand_x = random.randint(10, 150) + name_list = ['Grocery', 'Explosive', 'Electronic', 'Builders'] + image_list = ['img/package_grocery.png', 'img/package_explosive.png', 'img/package.png', 'img/package_builders.png'] + p1 = Package((a, b), rand_x, name_list[rand_y-1], image_list[rand_y-1]) return p1