27 lines
917 B
Python
27 lines
917 B
Python
from animal import Animal
|
|
import pygame
|
|
from datetime import datetime
|
|
|
|
class Bear(Animal):
|
|
def __init__(self, x, y, adult=False):
|
|
Bear_image = pygame.image.load('images/bear.png')
|
|
name = 'bear'
|
|
environment = "cold"
|
|
activity = 'nocturnal'
|
|
ill = self.is_ill()
|
|
bear_food = 'meat'
|
|
food_image = 'images/meat.png'
|
|
super().__init__(x, y,name, Bear_image, food_image,bear_food,environment, activity, ill, adult)
|
|
self._starttime = datetime.now()
|
|
|
|
def getting_hungry(self, const):
|
|
|
|
checktime = datetime.now()
|
|
delta = checktime - self._starttime
|
|
minutes_passed = delta.total_seconds() / (45)
|
|
self._starttime = checktime
|
|
|
|
if const.IS_NIGHT and self._feed < 10 and const.season != "winter":
|
|
self._feed += minutes_passed
|
|
self._feed = min(self._feed, 10)
|
|
return self._feed |