Male_zoo_Projekt_SI/Animals/penguin.py

26 lines
910 B
Python
Raw Normal View History

2024-03-22 20:11:58 +01:00
from animal import Animal
import pygame
from datetime import datetime
class Penguin(Animal):
def __init__(self, x, y, adult=False):
2024-03-23 13:55:16 +01:00
name = 'penguin'
Penguin_image = pygame.image.load(self.choose_picture(name))
environment = "cold"
activity = 'diurnal'
ill = self.is_ill()
2024-03-23 13:55:16 +01:00
food_image = 'images/fish.png'
penguin_food = 'fish'
super().__init__(x, y, name, Penguin_image, food_image, penguin_food, environment, activity, ill, adult)
2024-03-22 20:11:58 +01:00
self._starttime = datetime.now()
def getting_hungry(self, const):
2024-03-22 20:11:58 +01:00
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / (25)
2024-05-10 01:56:12 +02:00
self._starttime = checktime
2024-05-12 16:25:09 +02:00
if not const.IS_NIGHT and self._feed < 10:
self._feed += minutes_passed
2024-05-12 16:25:09 +02:00
self._feed = min(self._feed, 10)
2024-05-10 01:56:12 +02:00
return self._feed