diff --git a/images/tłojesień.jpg b/images/tłojesień.jpg new file mode 100644 index 0000000..c9215a5 Binary files /dev/null and b/images/tłojesień.jpg differ diff --git a/images/tłowiosna.jpg b/images/tłowiosna.jpg new file mode 100644 index 0000000..7e17fa2 Binary files /dev/null and b/images/tłowiosna.jpg differ diff --git a/images/tłozima.jpg b/images/tłozima.jpg new file mode 100644 index 0000000..8c49b50 Binary files /dev/null and b/images/tłozima.jpg differ diff --git a/main.py b/main.py index 8246fde..e0a4da6 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ import pygame import sys import sys sys.path.append('./Animals') + from animals import create_animals, draw_Animals from agent import Agent from enclosure import create_enclosures, draw_enclosures, draw_gates @@ -11,6 +12,7 @@ from state_space_search import graphsearch, generate_cost_map from terrain_obstacle import create_obstacles, draw_Terrain_Obstacles from constants import Constants, init_pygame from draw import draw_goal, draw_grid +from season import draw_background, draw_season const = Constants() init_pygame(const) @@ -75,7 +77,7 @@ def main(): actions = [] clock = pygame.time.Clock() spawned = False - + season = draw_season() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: @@ -83,12 +85,13 @@ def main(): sys.exit() agent.handle_event(event, const.GRID_WIDTH, const.GRID_HEIGHT, Animals, obstacles) - const.screen.blit(const.background_image, (0, 0)) + draw_background(const, season) draw_grid(const) draw_enclosures(Enclosures, const) draw_gates(Enclosures, const) if not spawned: + spawn_all_animals() spawn_obstacles() cost_map = generate_cost_map(Animals, Terrain_Obstacles) diff --git a/season.py b/season.py new file mode 100644 index 0000000..1e4a44a --- /dev/null +++ b/season.py @@ -0,0 +1,16 @@ +import pygame +import random +def draw_season(): + seasons = ["spring", "summer", "autumn", "winter"] + return random.choice(seasons) + +def draw_background(const, season): + season_images = { + "spring": "images/tłowiosna.jpg", + "summer": "images/tło.jpg", + "autumn": "images/tłojesień.jpg", + "winter": "images/tłozima.jpg" + } + background_image = pygame.transform.scale(pygame.image.load(season_images[season]), const.WINDOW_SIZE) + const.screen.blit(background_image, (0, 0)) +