board
This commit is contained in:
commit
934fe288b7
BIN
garbage_truck.png
Normal file
BIN
garbage_truck.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 KiB |
53
main.py
Normal file
53
main.py
Normal file
@ -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()
|
||||||
|
|
BIN
trash_can_bio.jpg
Normal file
BIN
trash_can_bio.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
trash_can_metale_plastik.jpg
Normal file
BIN
trash_can_metale_plastik.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
trash_can_papier.jpg
Normal file
BIN
trash_can_papier.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
trash_can_szklo.jpg
Normal file
BIN
trash_can_szklo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
trash_can_zmieszane.jpg
Normal file
BIN
trash_can_zmieszane.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user