2024-05-10 22:29:08 +02:00
|
|
|
from animal import Animal
|
|
|
|
import pygame
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
class Bat(Animal):
|
|
|
|
def __init__(self, x, y, adult=False):
|
|
|
|
name = 'bat'
|
2024-05-26 17:07:55 +02:00
|
|
|
Bat_image = pygame.image.load(self.choose_picture(name))
|
2024-05-10 22:29:08 +02:00
|
|
|
environment = "medium"
|
|
|
|
food_image = 'images/grains.png'
|
|
|
|
parrot_food = 'grains'
|
2024-05-12 16:25:09 +02:00
|
|
|
activity = 'nocturnal'
|
2024-05-10 22:29:08 +02:00
|
|
|
super().__init__(x, y,name, Bat_image, food_image,parrot_food, environment, adult)
|
|
|
|
self._starttime = datetime.now()
|
|
|
|
|
|
|
|
def getting_hungry(self, const):
|
|
|
|
checktime = datetime.now()
|
|
|
|
delta = checktime - self._starttime
|
2024-05-13 12:49:19 +02:00
|
|
|
minutes_passed = delta.total_seconds() / (25)
|
2024-05-10 22:29:08 +02:00
|
|
|
self._starttime = checktime
|
|
|
|
|
2024-05-12 16:25:09 +02:00
|
|
|
if const.IS_NIGHT and self._feed < 10:
|
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 22:29:08 +02:00
|
|
|
|
|
|
|
return self._feed
|