Male_zoo_Projekt_SI/penguin.py

32 lines
861 B
Python

from animal import Animal
import pygame
from datetime import datetime
class Penguin(Animal):
def __init__(self, x, y, adult=False):
Penguin_image = pygame.image.load('images/penguin.png')
name = 'penguin'
environment = "cold"
food_image = 'images/fish.png'
penguin_food = 'fish'
super().__init__(x, y,name, Penguin_image, food_image,penguin_food,environment, adult)
self._starttime = datetime.now()
def feed(self):
self.getting_hungry()
if self._feed < 2:
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