25 lines
808 B
Python
25 lines
808 B
Python
|
from animal import Animal
|
||
|
import pygame
|
||
|
from datetime import datetime
|
||
|
|
||
|
class Owl(Animal):
|
||
|
def __init__(self, x, y, adult=False):
|
||
|
Owl_image = pygame.image.load('images/owl.png')
|
||
|
name = 'owl'
|
||
|
environment = "medium"
|
||
|
food_image = 'images/grains.png'
|
||
|
parrot_food = 'grains'
|
||
|
super().__init__(x, y,name, Owl_image, food_image,parrot_food, environment, adult)
|
||
|
self._starttime = datetime.now()
|
||
|
|
||
|
def getting_hungry(self, const):
|
||
|
checktime = datetime.now()
|
||
|
delta = checktime - self._starttime
|
||
|
minutes_passed = delta.total_seconds() / 25
|
||
|
self._starttime = checktime
|
||
|
|
||
|
if const.IS_NIGHT and self._feed < 5:
|
||
|
self._feed += minutes_passed
|
||
|
self._feed = min(self._feed, 5)
|
||
|
|
||
|
return self._feed
|