import pygame
import random
import os
#КОНФИГИ
WIDTH = 800
HEIGHT = 800
FPS = 5

WHITE = (255, 255, 255)
ORANGE = (255, 125, 0)
BALACK = (0, 0, 0)



pygame.init()
pygame.mixer.init()
display = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("PatrickGame")
clock = pygame.time.Clock()

#СПРАЙТ ЛОАДЕРЫ

my_dir = os.path.dirname(__file__)
self_img = os.path.join(my_dir, 'img')

load = pygame.image.load(os.path.join(self_img, 'img.png')) #основной спрайт персонажа
pygame.transform.scale(load, (100, 100))
load0 = pygame.image.load(os.path.join(self_img, 'anime.png')) #спящий спрайт
pygame.transform.scale(load0, (32, 32))
load1 = pygame.image.load(os.path.join(self_img, 'img.png')) #счастливый спрайт
pygame.transform.scale(load1, (32, 32))
load2 = pygame.image.load(os.path.join(self_img, 'img.png')) #грустный спрайт
pygame.transform.scale(load1, (32, 32))
load3 = pygame.image.load(os.path.join(self_img, 'img.png')) #голодный спрайт
pygame.transform.scale(load1, (32, 32))
load4 = pygame.image.load(os.path.join(self_img, 'img.png')) #испытывающий жажду спрайт
pygame.transform.scale(load1, (32, 32))
load5 = pygame.image.load(os.path.join(self_img, 'img.png')) #еда
pygame.transform.scale(load1, (32, 32))
load6 = pygame.image.load(os.path.join(self_img, 'img.png')) #вода
pygame.transform.scale(load1, (32, 32))
#РАЗНОВИДНОСТИ ТАМОГОЧИ И КЛАССЫ

class BaseTamogochi(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = load
        self.rect = self.image.get_rect()

class HappyTamogochi(BaseTamogochi):
    def __init__(self):
        super().__init__()
        self.image = load0
        self.rect = self.image.get_rect()

class SadTamogochi(BaseTamogochi):
    def __init__(self):
        super().__init__()
        self.image = load1
        self.rect = self.image.get_rect()

class HungredTamogochi(BaseTamogochi):
    def __init__(self):
        super().__init__()
        self.image = load2
        self.rect = self.image.get_rect()

class ThirstyTamogochi(BaseTamogochi):
    def __init__(self):
        super().__init__()
        self.image = load3
        self.rect = self.image.get_rect()

class SleepyTamogochi(BaseTamogochi):
    def __init__(self):
        super().__init__()
        self.image = load3
        self.rect = self.image.get_rect()



#ЕДА
class Food_Water(pygame.sprite.Sprite): #Патрик делай свой проект, я разберусь с Гришей. Хорошо
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.food_img = load4 #еда
        self.water_img = load5 #вода

    def feed(self):
        key = pygame.key.get_pressed()
        if key[pygame.K_e]:
            hungry - food_give


#НАСТРОЙКИ физики
tamgoch = BaseTamogochi()
happy = HappyTamogochi()
sad = SadTamogochi()
sleep = SleepyTamogochi()
thirst = ThirstyTamogochi()
hunger = HungredTamogochi()

base_otrisovka = pygame.sprite.Group()
happy_otrisovka = pygame.sprite.Group()
sad_otrisovka = pygame.sprite.Group()
sleep_otrisovka = pygame.sprite.Group()
thirst_otrisovka = pygame.sprite.Group()
hunger_otrisovka = pygame.sprite.Group()
base_otrisovka.add(tamgoch)
happy_otrisovka.add(happy)
sad_otrisovka.add(sad)
sleep_otrisovka.add(sleep)
thirst_otrisovka.add(thirst)
hunger_otrisovka.add(hunger)

happiness = 100
saddness = 0
sleepy = 0
thirsty = 0
hungry = 0
food_give = random.randint(10, 100)
water_give = random.randint(10, 100)

if hungry < 0:
    hungry = 0
if thirsty < 0:
    thirsty = 0

running = True
while running:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    happiness -= 1
    saddness += 1
    sleepy += 1
    thirsty += 1
    hungry += 1
    display.fill(ORANGE)

    #НАСТРОЙКИ HAPPINES
    if happiness <= 40:
        happy_otrisovka.draw(display)
    else:
        base_otrisovka.draw(display)
    #НАСТРОЙКИ SADDNESS
    if saddness >= 50:
        sad_otrisovka.draw(display)
    else:
        base_otrisovka.draw(display)
    # НАСТРОЙКИ SlEEP
    if sleepy >= 50:
        sleep_otrisovka.draw(display)
    else:
        base_otrisovka.draw(display)
    # НАСТРОЙКИ THIRST
    if thirsty >= 50:
        thirst_otrisovka.draw(display)
    else:
        base_otrisovka.draw(display)
    # НАСТРОЙКИ HUNGER
    if hungry >= 50:
        hunger_otrisovka.draw(display)
    else:
        base_otrisovka.draw(display)

    pygame.display.flip()
pygame.quit()