parent
3cb88fe198
commit
be0e7e0bf4
|
@ -136,8 +136,8 @@ class Pet(object):
|
|||
time.sleep(15)
|
||||
self.decrease_hunger()
|
||||
if self.hunger <= 0:
|
||||
decrease_health()
|
||||
decrease_happiness()
|
||||
self.decrease_health()
|
||||
self.decrease_happiness()
|
||||
|
||||
|
||||
### Activities ###
|
||||
|
@ -211,4 +211,4 @@ class Pet(object):
|
|||
print("Your pet woke up feeling rested and in a good mood.")
|
||||
else:
|
||||
print("Your pet has woken up.")
|
||||
time.sleep(3)
|
||||
time.sleep(3)
|
||||
|
|
|
@ -14,9 +14,11 @@ fish = "<`)))><"
|
|||
owl = "(^0M0^)"
|
||||
|
||||
# initializing the tamagotchi
|
||||
tamagotchi = Pet(name="empty", photo="empty", status="youngling", age=0, health=5, hunger=5, happiness=5, max_happiness=10, max_health=5, max_hunger=5, poke_count=0)
|
||||
tamagotchi = Pet(name="empty", photo="empty", status="youngling", age=0, health=5, hunger=5, happiness=5,
|
||||
max_happiness=10, max_health=5, max_hunger=5, poke_count=0)
|
||||
|
||||
# A function which let's the player choose his pet.
|
||||
|
||||
# A function which let's the player choose his pet.
|
||||
def beginning():
|
||||
global beginning_finished
|
||||
print("Which pet do you want to look after?")
|
||||
|
@ -35,11 +37,12 @@ def beginning():
|
|||
tamagotchi.photo = pet_photo
|
||||
beginning_finished = True
|
||||
|
||||
|
||||
# Beginning of the main routine which makes up the actual game.
|
||||
|
||||
# thread which runs in the background to cause hunger, etc
|
||||
#t = threading.Thread(target=tamagotchi.decrease_stats())
|
||||
#t.start()
|
||||
t = threading.Thread(target=tamagotchi.decrease_stats())
|
||||
t.start()
|
||||
# Only starts if the pet is still alive.
|
||||
while tamagotchi.is_alive():
|
||||
if not beginning_finished:
|
||||
|
@ -76,4 +79,4 @@ while tamagotchi.is_alive():
|
|||
tamagotchi.display_stats()
|
||||
except ValueError:
|
||||
tamagotchi.display_stats()
|
||||
print("Your pet died.")
|
||||
print("Your pet died.")
|
||||
|
|
Reference in New Issue