This commit is contained in:
Aga 2023-05-04 16:12:42 +02:00
parent a9cdee96e0
commit 5204f745ad

View File

@ -30,11 +30,11 @@ class Cart:
cart_rect): # sprawdza czy dany ruch, który chce wykonać wózek jest możliwy, zwraca prawdę lub fałsz
if self.direction == definitions.CART_DIRECTION_EAST and cart_rect.x + definitions.BLOCK_SIZE < definitions.WIDTH_MAP:
return True
elif self.direction == definitions.CART_DIRECTION_SOUTH and cart_rect.y - definitions.BLOCK_SIZE >= 0:
elif self.direction == definitions.CART_DIRECTION_SOUTH and cart_rect.y - definitions.BLOCK_SIZE > 0:
return True
elif self.direction == definitions.CART_DIRECTION_NORTH and cart_rect.y + definitions.BLOCK_SIZE < definitions.HEIGHT_MAP:
return True
elif self.direction == definitions.CART_DIRECTION_WEST and cart_rect.x - definitions.BLOCK_SIZE >= 0:
elif self.direction == definitions.CART_DIRECTION_WEST and cart_rect.x - definitions.BLOCK_SIZE > 0:
return True
else:
return False
@ -44,11 +44,11 @@ class Cart:
node): # sprawdza czy dany ruch, który chce wykonać wózek jest możliwy, zwraca pozycje po wykonaniu ruchu, wersja node
if node.get_direction() == definitions.CART_DIRECTION_EAST and node.get_x() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.WIDTH_MAP:
return "x + 1"
elif node.get_direction() == definitions.CART_DIRECTION_NORTH and node.get_y() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE >= 0:
elif node.get_direction() == definitions.CART_DIRECTION_NORTH and node.get_y() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE > 0:
return "y - 1"
elif node.get_direction() == definitions.CART_DIRECTION_SOUTH and node.get_y() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.HEIGHT_MAP:
return "y + 1"
elif node.get_direction() == definitions.CART_DIRECTION_WEST and node.get_x() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE >= 0:
elif node.get_direction() == definitions.CART_DIRECTION_WEST and node.get_x() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE > 0:
return "x - 1"
else:
return False