Poprawka wizualna

This commit is contained in:
andrzej 2020-05-03 18:21:25 +02:00
parent 2cee412170
commit b9fa16a5a9
3 changed files with 9 additions and 1 deletions

View File

@ -20,7 +20,8 @@ COLORS = {
'lightgreen': (70, 238, 70), 'lightgreen': (70, 238, 70),
'red': (255, 0, 0), 'red': (255, 0, 0),
'lightblue': (120, 180, 230), 'lightblue': (120, 180, 230),
'iceblue': (186,242,239), 'iceblue': (186, 242, 239),
'blue': (0, 0, 255),
'orange': (255, 165, 0) 'orange': (255, 165, 0)
} }

View File

@ -81,6 +81,10 @@ class MainGameFrame:
package_color = get_package_color(pack) package_color = get_package_color(pack)
pygame.draw.rect(self.display, package_color, pygame.draw.rect(self.display, package_color,
((pack_x * TILE_WIDTH) + 3, (pack_y * TILE_HEIGHT) + 3, TILE_WIDTH - 5, TILE_HEIGHT - 5)) ((pack_x * TILE_WIDTH) + 3, (pack_y * TILE_HEIGHT) + 3, TILE_WIDTH - 5, TILE_HEIGHT - 5))
if pack.category == "freezed":
pygame.draw.rect(self.display, COLORS['blue'],
((pack_x * TILE_WIDTH) + 2, (pack_y * TILE_HEIGHT) + 2, TILE_WIDTH - 4,
TILE_HEIGHT - 4), 3)
def draw_nums(self): def draw_nums(self):
for row in self.warehouse_map.tiles: for row in self.warehouse_map.tiles:

View File

@ -195,6 +195,9 @@ class Warehouse:
pack_x, pack_y = self._set_package_position() pack_x, pack_y = self._set_package_position()
package_field = self.tiles[pack_x][pack_y] package_field = self.tiles[pack_x][pack_y]
new_package = Pack(lays_on_field=package_field) new_package = Pack(lays_on_field=package_field)
categ_seed = random.random()
if categ_seed > 0.8:
new_package.category = "freezed"
new_package.size = random.randrange(1, 10) new_package.size = random.randrange(1, 10)
if package_field.category.name in self.storage_types: if package_field.category.name in self.storage_types:
package_field.capacity -= new_package.size package_field.capacity -= new_package.size