Change in generate package

This commit is contained in:
Miron 2021-04-18 17:53:18 +02:00
parent 87f27dac52
commit 45f42770db

View File

@ -15,16 +15,11 @@ DOCK = pygame.transform.scale(pygame.image.load('img/dock_left.png'), (75, 75))
def generate_package(a, b): def generate_package(a, b):
y = random.randint(1, 4) rand_y = random.randint(1, 4)
x = random.randint(10, 150) rand_x = random.randint(10, 150)
if y == 1: name_list = ['Grocery', 'Explosive', 'Electronic', 'Builders']
p1 = Package((a, b), x, "Grocery", 'img/package_grocery.png') image_list = ['img/package_grocery.png', 'img/package_explosive.png', 'img/package.png', 'img/package_builders.png']
elif y == 2: p1 = Package((a, b), rand_x, name_list[rand_y-1], image_list[rand_y-1])
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')
return p1 return p1