dodanie pór roku
This commit is contained in:
parent
53cfae3fb8
commit
80d2326c3f
BIN
images/tłojesień.jpg
Normal file
BIN
images/tłojesień.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 222 KiB |
BIN
images/tłowiosna.jpg
Normal file
BIN
images/tłowiosna.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 229 KiB |
BIN
images/tłozima.jpg
Normal file
BIN
images/tłozima.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 KiB |
7
main.py
7
main.py
@ -3,6 +3,7 @@ import pygame
|
|||||||
import sys
|
import sys
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('./Animals')
|
sys.path.append('./Animals')
|
||||||
|
|
||||||
from animals import create_animals, draw_Animals
|
from animals import create_animals, draw_Animals
|
||||||
from agent import Agent
|
from agent import Agent
|
||||||
from enclosure import create_enclosures, draw_enclosures, draw_gates
|
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 terrain_obstacle import create_obstacles, draw_Terrain_Obstacles
|
||||||
from constants import Constants, init_pygame
|
from constants import Constants, init_pygame
|
||||||
from draw import draw_goal, draw_grid
|
from draw import draw_goal, draw_grid
|
||||||
|
from season import draw_background, draw_season
|
||||||
|
|
||||||
const = Constants()
|
const = Constants()
|
||||||
init_pygame(const)
|
init_pygame(const)
|
||||||
@ -75,7 +77,7 @@ def main():
|
|||||||
actions = []
|
actions = []
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
spawned = False
|
spawned = False
|
||||||
|
season = draw_season()
|
||||||
while True:
|
while True:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
@ -83,12 +85,13 @@ def main():
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
agent.handle_event(event, const.GRID_WIDTH, const.GRID_HEIGHT, Animals, obstacles)
|
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_grid(const)
|
||||||
draw_enclosures(Enclosures, const)
|
draw_enclosures(Enclosures, const)
|
||||||
draw_gates(Enclosures, const)
|
draw_gates(Enclosures, const)
|
||||||
|
|
||||||
if not spawned:
|
if not spawned:
|
||||||
|
|
||||||
spawn_all_animals()
|
spawn_all_animals()
|
||||||
spawn_obstacles()
|
spawn_obstacles()
|
||||||
cost_map = generate_cost_map(Animals, Terrain_Obstacles)
|
cost_map = generate_cost_map(Animals, Terrain_Obstacles)
|
||||||
|
16
season.py
Normal file
16
season.py
Normal file
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user