Male_zoo_Projekt_SI/Animals/animals.py

62 lines
1.9 KiB
Python
Raw Normal View History

2024-04-27 19:50:18 +02:00
from elephant import Elephant
from giraffe import Giraffe
from penguin import Penguin
from parrot import Parrot
from bear import Bear
from owl import Owl
from bat import Bat
2024-04-27 19:50:18 +02:00
def create_animals():
giraffe1 = Giraffe(0, 0, adult=True)
giraffe2 = Giraffe(0, 0, adult=True)
giraffe3 = Giraffe(0, 0, adult=True)
giraffe4 = Giraffe(0, 0)
giraffe5 = Giraffe(0, 0)
bear1 = Bear(0, 0, adult=True)
bear2 = Bear(0, 0, adult=True)
bear3 = Bear(0, 0)
bear4 = Bear(0, 0)
bear5 = Bear(0, 0)
penguin1 = Penguin(0, 0)
penguin2 = Penguin(0, 0)
penguin3 = Penguin(0, 0)
penguin4 = Penguin(0, 0)
elephant1 = Elephant(0, 0, adult=True)
elephant2 = Elephant(0, 0, adult=True)
elephant3 = Elephant(0, 0)
elephant4 = Elephant(0, 0)
elephant5 = Elephant(0, 0)
parrot1 = Parrot(0, 0)
parrot2 = Parrot(0, 0)
owl1 = Owl(0, 0)
owl2 = Owl(0, 0)
bat1 = Bat(0, 0)
bat2 = Bat(0, 0)
2024-04-27 19:50:18 +02:00
Animals = [giraffe1, giraffe2, giraffe3, giraffe4, giraffe5,
bear1, bear2, bear3, bear4, bear5,
elephant1, elephant2, elephant3, elephant4, elephant5,
penguin1, penguin2, penguin3, penguin4,
parrot1, parrot2, owl1, owl2, bat1, bat2]
2024-04-27 19:50:18 +02:00
return Animals
def draw_Animals(Animals, const):
for Animal in Animals:
Animal.draw(const.screen, const.GRID_SIZE)
hunger_level = Animal.getting_hungry(const)
if hunger_level >= 9:
food_image = 'images/empty_bowl.png'
elif hunger_level >= 8:
food_image = 'images/almost_empty.png'
elif hunger_level >= 5:
food_image = 'images/half_bowl.png'
else:
food_image = 'images/full_bowl.png'
Animal.draw_food(const.screen, const.GRID_SIZE, Animal.x, Animal.y, food_image)
if Animal.ill:
Animal.draw_illness(const.screen, const.GRID_SIZE, Animal.x, Animal.y)