2023-03-23 20:52:46 +01:00
|
|
|
import pygame
|
2023-04-22 21:31:19 +02:00
|
|
|
from settings import block_size
|
2023-03-23 20:52:46 +01:00
|
|
|
|
|
|
|
class Plant(pygame.sprite.Sprite):
|
2023-05-25 18:11:06 +02:00
|
|
|
def __init__(self,wzrost,
|
|
|
|
wilgotnosc,
|
|
|
|
dni_od_nawiezienia,
|
|
|
|
aktualna_pogoda,
|
|
|
|
czy_robaczywa,
|
|
|
|
cena_sprzedarzy,
|
|
|
|
species,
|
|
|
|
pos_x,
|
|
|
|
pos_y):
|
|
|
|
|
2023-03-23 20:52:46 +01:00
|
|
|
super().__init__()
|
|
|
|
self.species=species
|
2023-05-25 18:11:06 +02:00
|
|
|
self.wzrost=wzrost
|
|
|
|
self.wilgotnosc=wilgotnosc
|
|
|
|
self.dni_od_nawiezienia=dni_od_nawiezienia
|
|
|
|
self.aktualna_pogoda=aktualna_pogoda
|
|
|
|
self.czy_robaczywa=czy_robaczywa
|
|
|
|
self.cena_sprzedarzy=cena_sprzedarzy
|
2023-03-23 20:52:46 +01:00
|
|
|
if species=="carrot":
|
|
|
|
self.growth_time=100
|
|
|
|
self.weight=50
|
2023-03-26 12:00:34 +02:00
|
|
|
self.min_hydration = 30
|
|
|
|
self.max_hydration = 60
|
|
|
|
self.soil_type = "torf"
|
2023-03-23 20:52:46 +01:00
|
|
|
self.fertilizer="carrot_fertilizer"
|
|
|
|
self.pic_path="assets/Carrot.png"
|
|
|
|
|
|
|
|
elif species=="beetroot":
|
|
|
|
self.growth_time=200
|
|
|
|
self.weight=200
|
2023-03-26 12:00:34 +02:00
|
|
|
self.min_hydration = 20
|
|
|
|
self.max_hydration = 60
|
|
|
|
self.soil_type = "piaszczyste"
|
2023-03-23 20:52:46 +01:00
|
|
|
self.fertilizer="beetroot_fertilizer"
|
|
|
|
self.pic_path="assets/Beetroot.png"
|
|
|
|
|
|
|
|
elif species=="potato":
|
|
|
|
self.growth_time=100
|
|
|
|
self.weight=100
|
2023-03-26 12:00:34 +02:00
|
|
|
self.min_hydration = 10
|
|
|
|
self.max_hydration = 30
|
|
|
|
self.soil_type = "ilaste"
|
2023-03-23 20:52:46 +01:00
|
|
|
self.fertilizer="potatoe_fertilizer"
|
|
|
|
self.pic_path="assets/Potato.png"
|
|
|
|
|
|
|
|
else:
|
|
|
|
self.growth_time=250
|
|
|
|
self.weight=75
|
2023-03-26 12:00:34 +02:00
|
|
|
self.min_hydration = 10
|
|
|
|
self.max_hydration = 65
|
|
|
|
self.soil_type = "gliniaste"
|
2023-03-23 20:52:46 +01:00
|
|
|
self.fertilizer="wheat_fertilizer"
|
|
|
|
self.pic_path="assets/Wheat.png"
|
|
|
|
|
|
|
|
self.image = pygame.image.load(self.pic_path) #zmienic
|
2023-04-22 21:31:19 +02:00
|
|
|
self.image = pygame.transform.scale(self.image,(block_size, block_size))
|
2023-03-23 20:52:46 +01:00
|
|
|
self.rect = self.image.get_rect()
|
|
|
|
self.rect.center = [pos_x,pos_y]
|
2023-05-25 18:11:06 +02:00
|
|
|
|
2023-05-28 10:23:30 +02:00
|
|
|
def getParameters(self):
|
|
|
|
return [self.wzrost, self.wilgotnosc, self.dni_od_nawiezienia,self.aktualna_pogoda,self.czy_robaczywa,self.cena_sprzedarzy]
|