29 lines
863 B
Python
29 lines
863 B
Python
from animal import Animal
|
|
import pygame
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
class Giraffe(Animal):
|
|
def __init__(self, x, y, adult=False):
|
|
Giraffe_image = pygame.image.load('images/giraffe.png')
|
|
name = 'giraffe'
|
|
environment = "hot"
|
|
activity = 'diurnal'
|
|
ill = self.is_ill()
|
|
food_image = 'images/leaves.png'
|
|
giraffe_food = 'leaves'
|
|
super().__init__(x, y, name, Giraffe_image, food_image,giraffe_food, environment, activity, ill, adult)
|
|
self._starttime = datetime.now()
|
|
|
|
|
|
|
|
def getting_hungry(self):
|
|
checktime = datetime.now()
|
|
delta = checktime - self._starttime
|
|
minutes_passed = delta.total_seconds() / 30
|
|
self._feed += minutes_passed
|
|
self._starttime = checktime
|
|
if self._feed > 5:
|
|
self._feed = 5
|
|
return self._feed |