2024-03-22 20:11:58 +01:00
|
|
|
from animal import Animal
|
|
|
|
import pygame
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
class Bear(Animal):
|
|
|
|
def __init__(self, x, y, adult=False):
|
2024-03-23 13:55:16 +01:00
|
|
|
name = 'bear'
|
2024-05-26 17:07:55 +02:00
|
|
|
Bear_image = pygame.image.load(self.choose_picture(name))
|
2024-03-24 17:33:58 +01:00
|
|
|
environment = "cold"
|
2024-05-10 18:32:23 +02:00
|
|
|
activity = 'nocturnal'
|
|
|
|
ill = self.is_ill()
|
2024-03-23 13:55:16 +01:00
|
|
|
bear_food = 'meat'
|
|
|
|
food_image = 'images/meat.png'
|
2024-05-10 18:32:23 +02:00
|
|
|
super().__init__(x, y,name, Bear_image, food_image,bear_food,environment, activity, ill, adult)
|
2024-03-22 20:11:58 +01:00
|
|
|
self._starttime = datetime.now()
|
|
|
|
|
2024-05-10 22:29:08 +02:00
|
|
|
def getting_hungry(self, const):
|
2024-03-22 20:11:58 +01:00
|
|
|
|
|
|
|
checktime = datetime.now()
|
|
|
|
delta = checktime - self._starttime
|
2024-05-13 12:49:19 +02:00
|
|
|
minutes_passed = delta.total_seconds() / (45)
|
2024-05-10 01:56:12 +02:00
|
|
|
self._starttime = checktime
|
2024-05-10 22:29:08 +02:00
|
|
|
|
2024-05-12 16:25:09 +02:00
|
|
|
if const.IS_NIGHT and self._feed < 10 and const.season != "winter":
|
2024-05-10 22:29:08 +02:00
|
|
|
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
|