Male_zoo_Projekt_SI/parrot.py

31 lines
819 B
Python
Raw Permalink Normal View History

2024-03-22 20:11:58 +01:00
from animal import Animal
import pygame
from datetime import datetime
class Parrot(Animal):
def __init__(self, x, y, adult=False):
Parrot_image = pygame.image.load('images/parrot.png')
2024-03-23 13:55:16 +01:00
name = 'parrot'
food_image = 'images/grains.png'
parrot_food = 'grains'
super().__init__(x, y,name, Parrot_image, food_image,parrot_food, adult)
2024-03-22 20:11:58 +01:00
self._starttime = datetime.now()
def feed(self):
self.getting_hungry()
2024-03-23 13:55:16 +01:00
if self._feed < 1.5:
2024-03-22 20:11:58 +01:00
return 'False'
else:
return 'True'
def getting_hungry(self):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 60
self._feed += minutes_passed
self._starttime = checktime