AI_PROJECT/Image.py
Mateusz Czajka ae462e2920 New surfaces were made (mud, dirt, stone).
Renamed from bfs2 to bfs3.
Added koszt to Stan and it's set automatically.
Added some ideas about A*.
2024-04-24 22:16:34 +02:00

48 lines
1.7 KiB
Python

import pygame
import displayControler as dCon
import random
class Image:
def __init__(self):
self.plants_image_dict={}
self.tractor_image=None
self.garage_image=None
self.stone_image=None
def load_images(self):
files_plants={0:"borowka",
1:"kukurydza",
2:"pszenica",
3:"slonecznik",
4:"winogrono",
5:"ziemniak",
6:"dirt",
7:"mud"}
for index in files_plants:
if index >= 6:
plant_image = pygame.image.load("images/" + files_plants[index] + ".jpg")
else:
plant_image=pygame.image.load("images/plants/"+files_plants[index]+".jpg")
plant_image=pygame.transform.scale(plant_image,(dCon.CUBE_SIZE,dCon.CUBE_SIZE))
self.plants_image_dict[files_plants[index]]=plant_image
tractor_image=pygame.image.load("images/traktor.png")
tractor_image=pygame.transform.scale(tractor_image,(dCon.CUBE_SIZE,dCon.CUBE_SIZE))
garage=pygame.image.load("images/garage.png")
self.garage_image=pygame.transform.scale(garage,(dCon.CUBE_SIZE,dCon.CUBE_SIZE))
stone=pygame.image.load("images/stone.png")
self.stone_image=pygame.transform.scale(stone,(dCon.CUBE_SIZE,dCon.CUBE_SIZE))
def return_random_plant(self):
x=random.randint(0,7)
keys=list(self.plants_image_dict.keys())
plant=keys[x]
return (plant,self.plants_image_dict[plant])
def return_plant(self,plant_name):
return (plant_name,self.plants_image_dict[plant_name])
def return_garage(self):
return self.garage_image
def return_stone(self):
return self.stone_image