Naprawa znikających misek i przyspieszenie głodu zwierząt

This commit is contained in:
s481832 2024-05-12 20:17:43 +02:00
parent b0175f56d7
commit 8fcb368258
10 changed files with 19 additions and 20 deletions

View File

@ -43,22 +43,20 @@ def create_animals():
def draw_Animals(Animals, const):
for Animal in Animals:
Animal.draw(const.screen, const.GRID_SIZE)
hunger_level = Animal.getting_hungry(const)
if Animal.getting_hungry(const) == 10:
Animal.draw_exclamation(const.screen, const.GRID_SIZE, Animal.x, Animal.y)
Animal.draw_food(const.screen,const.GRID_SIZE,Animal.x,Animal.y,'images/empty_bowl.png')
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'
if Animal.getting_hungry(const) >= 8 and Animal.getting_hungry(const) < 5:
Animal.draw_exclamation(const.screen, const.GRID_SIZE, Animal.x, Animal.y)
Animal.draw_food(const.screen,const.GRID_SIZE,Animal.x,Animal.y,'images/almost_empty.png')
if Animal.getting_hungry(const) >= 5 and Animal.getting_hungry(const) < 4:
Animal.draw_food(const.screen,const.GRID_SIZE,Animal.x,Animal.y,'images/half_bowl.png')
if Animal.getting_hungry(const) < 5:
Animal.draw_food(const.screen,const.GRID_SIZE,Animal.x,Animal.y,'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)

View File

@ -16,7 +16,7 @@ class Bat(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 30
minutes_passed = delta.total_seconds() / 30*5
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10:

View File

@ -18,7 +18,7 @@ class Bear(Animal):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 60
minutes_passed = delta.total_seconds() / 60*5
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10 and const.season != "winter":

View File

@ -22,7 +22,7 @@ class Elephant(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 50
minutes_passed = delta.total_seconds() / 50*5
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Giraffe(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 30
minutes_passed = delta.total_seconds() / 30*5
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -16,7 +16,7 @@ class Owl(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 25
minutes_passed = delta.total_seconds() / 25*5
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Parrot(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 20
minutes_passed = delta.total_seconds() / 20*5
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Penguin(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 15
minutes_passed = delta.total_seconds() / 15*5
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -101,6 +101,7 @@ def main():
cost_map = generate_cost_map(Animals, Terrain_Obstacles)
for animal in Animals:
animal._feed = 0
# animal._feed = random.randint(0, 10)
spawned = True
draw_Animals(Animals, const)

BIN
tree.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 KiB

After

Width:  |  Height:  |  Size: 764 KiB