Male_zoo_Projekt_SI/Animals/elephant.py

37 lines
1000 B
Python

from animal import Animal
import pygame
from datetime import datetime
class Elephant(Animal):
def __init__(self, x, y, adult=False):
Elephant_image = pygame.image.load('images/elephant.png')
name = 'elephant'
environment = "hot"
if adult:
elephant_food = 'leavs'
food_image = 'images/leaves.png'
else:
elephant_food = 'milk'
food_image = 'images/milk.png'
super().__init__(x, y,name, Elephant_image, food_image,elephant_food, environment, adult)
self._starttime = datetime.now()
def feed(self):
self.getting_hungry()
if self._feed < 0.3:
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