fixes_for_picking_up_and_screen_size #16

Merged
s472778 merged 4 commits from fixes_for_picking_up_and_screen_size into master 2023-05-28 00:08:41 +02:00
4 changed files with 23 additions and 4 deletions
Showing only changes of commit 82d1b7088e - Show all commits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -3,8 +3,9 @@ import pygame,math
from packageList import listOfPackages
class Wozek():
class Wozek(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.obecnyStan = None
# self.x = 55
# self.y = 55
@ -13,12 +14,14 @@ class Wozek():
self.height = 64
self.width = 64
self.image = pygame.image.load("images/pusty_wozek.png")
self.rect = self.image.get_rect()
# Credit: Forklift icons created by Smashicons - Flaticon
# https://www.flaticon.com/free-icons/forklift
self.__zainicjuj_stan_poczatkowy()
def draw(self):
ekran.screen.blit(self.image, (self.obecnyStan.x, self.obecnyStan.y))
# self.update_position(self.obecnyStan.x, self.obecnyStan.y)
#storage = ["none"] * 10
storage = []
@ -39,6 +42,11 @@ class Wozek():
else:
print("I'm empty!")
def update_position(self, x, y):
self.obecnyStan.x = x
self.obecnyStan.y = y
self.rect.topleft = (x, y)
def dynamic_wozek_picture(self):
if self.ln == 0:
self.image = pygame.image.load("images/pusty_wozek.png")
@ -49,6 +57,8 @@ class Wozek():
elif (self.ln == 10):
self.image = pygame.image.load("images/pelny_wozek_full_3_crates.png")
self.rect = self.image.get_rect()
def load_package(self):
for package in listOfPackages.list:
@ -56,12 +66,21 @@ class Wozek():
if dist <= 50:
self.add_element(package)
listOfPackages.list.pop()
def load_packages_collision(self):
pass
# packages_collision = pygame.sprite.spritecollide(self, listOfPackages.package_group, False)
# if packages_collision:
# for package in packages_collision:
# self.add_element(package)
# listOfPackages.list.remove(package) # collision doesn't work, collision always happens
def drop_package(self):
package = self.remove_element()
if package is not None:
listOfPackages.list.append(package)
package.x = self.obecnyStan.x+50
package.x = self.obecnyStan.x
package.y = self.obecnyStan.y
listOfPackages.list.append(package)
def __zainicjuj_stan_poczatkowy(self):
from wyszukiwanie import Stan