commit 934fe288b78e5da3d8900babaa6dbe1929bf16b2 Author: s481872 Date: Sun Mar 10 14:32:06 2024 +0100 board diff --git a/garbage_truck.png b/garbage_truck.png new file mode 100644 index 0000000..d64d05e Binary files /dev/null and b/garbage_truck.png differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..83b1321 --- /dev/null +++ b/main.py @@ -0,0 +1,53 @@ +import pygame +import random + +pygame.init() +screen = pygame.display.set_mode((1800, 1000)) + +garbage_truck_image = pygame.image.load('garbage_truck.png') + +trash_can_images = { + 'paper': pygame.image.load('trash_can_papier.jpg').convert_alpha(), + 'metals_and_plastics': pygame.image.load('trash_can_metale_plastik.jpg').convert_alpha(), + 'mixed': pygame.image.load('trash_can_zmieszane.jpg').convert_alpha(), + 'bio_waste': pygame.image.load('trash_can_bio.jpg').convert_alpha(), + 'glass': pygame.image.load('trash_can_szklo.jpg').convert_alpha(), +} + +new_garbage_truck_size = (120, 120) +new_trash_can_size = (120, 120) + +garbage_truck_image = garbage_truck_image.convert_alpha() +garbage_truck_image = pygame.transform.scale(garbage_truck_image, new_garbage_truck_size) + +for key in trash_can_images: + trash_can_images[key] = pygame.transform.scale(trash_can_images[key], new_trash_can_size) + +garbage_truck_position = [800, 500] + +trash_cans = [ + {'position': [100, 100], 'type': 'paper'}, + {'position': [1500, 800], 'type': 'metals_and_plastics'}, + {'position': [750, 800], 'type': 'mixed'}, + {'position': [100, 800], 'type': 'bio_waste'}, + {'position': [1500, 100], 'type': 'glass'}, +] + +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + garbage_truck_position[0] += random.randint(-4, 4) + garbage_truck_position[1] += random.randint(-4, 4) + + screen.fill((255, 255, 255)) + screen.blit(garbage_truck_image, garbage_truck_position) + for trash_can in trash_cans: + screen.blit(trash_can_images[trash_can['type']], trash_can['position']) + + pygame.display.flip() + +pygame.quit() + diff --git a/trash_can_bio.jpg b/trash_can_bio.jpg new file mode 100644 index 0000000..8c3c851 Binary files /dev/null and b/trash_can_bio.jpg differ diff --git a/trash_can_metale_plastik.jpg b/trash_can_metale_plastik.jpg new file mode 100644 index 0000000..9a59093 Binary files /dev/null and b/trash_can_metale_plastik.jpg differ diff --git a/trash_can_papier.jpg b/trash_can_papier.jpg new file mode 100644 index 0000000..471181b Binary files /dev/null and b/trash_can_papier.jpg differ diff --git a/trash_can_szklo.jpg b/trash_can_szklo.jpg new file mode 100644 index 0000000..91ba002 Binary files /dev/null and b/trash_can_szklo.jpg differ diff --git a/trash_can_zmieszane.jpg b/trash_can_zmieszane.jpg new file mode 100644 index 0000000..76eb8b5 Binary files /dev/null and b/trash_can_zmieszane.jpg differ