+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index b3f7e05..b8facd0 100644
--- a/README.md
+++ b/README.md
@@ -27,8 +27,7 @@ tamagotchi programme which shouldn't be too hard:
* add a function let the user exit the game
* safe the stats in a text file
-##30.6.2015
-
+## 30.6.2015
Time function has to be implemented otherwise the decrease.* functions won't work.
It seems to work however the import time part has to go into the pet_functions.py file.
Maybe I should move all the imports to that file otherwise it's not clear why they are needed.
@@ -38,9 +37,10 @@ And added the time import. Things are working now like intended.
However the pet doesn't get updated automatically. I currently don't know how to achieve that.
I'll have to ask reddit how to do it.
-##6.7.2015
-
+## 06.07.2015
I've written a function to decrease the stats in the background. Means the tamagotchi can now get hungry etc.
However it currently doesn't work. I don't know why atm. If you call it independently it works just fine.
In addition I've cleaned up the code a bit and made sure that the stats variables don't fall under 0 because that might cause some problems in the future.
+
+## 07.07.2015
diff --git a/__pycache__/pet_functions.cpython-34.pyc b/__pycache__/pet_functions.cpython-34.pyc
index 123e342..82e9bea 100644
Binary files a/__pycache__/pet_functions.cpython-34.pyc and b/__pycache__/pet_functions.cpython-34.pyc differ
diff --git a/__pycache__/pet_variables.cpython-34.pyc b/__pycache__/pet_variables.cpython-34.pyc
index 54a506e..06222b2 100644
Binary files a/__pycache__/pet_variables.cpython-34.pyc and b/__pycache__/pet_variables.cpython-34.pyc differ
diff --git a/pet_variables.py b/pet_variables.py
index d52c3dc..318a17f 100644
--- a/pet_variables.py
+++ b/pet_variables.py
@@ -12,8 +12,11 @@ max_health = 5
max_hunger = 5
max_happiness = 10
-# Pictures and symboles used ingame
+# Pictures and symbols used ingame
cat = "(=^o.o^=)__"
mouse = "<:3 )~~~~"
fish = "<`)))><"
owl = "(^0M0^)"
+
+# programme variables
+beginning_finished = False
diff --git a/tamagotchi.py b/tamagotchi.py
index f22c559..a232490 100644
--- a/tamagotchi.py
+++ b/tamagotchi.py
@@ -1,21 +1,22 @@
# import the threading module
import threading
-# import custom modules
-# A function to nicely print out the pets stats
+# import the pets_variables
+import pet_variables
+# a module which includes various custom functions
import pet_functions
-# Variable needed to skip the beginning when finished
-beginning_finished = False
# 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=pet_functions.decrease_stats)
+t.start()
# Only starts if the pet is still alive.
while pet_functions.is_alive():
- t = threading.Thread(target=pet_functions.decrease_stats)
- t.start()
- if not beginning_finished:
+ if not pet_variables.beginning_finished:
# Let the player choose his pet and skip the beginning from then on.
pet_functions.beginning()
- beginning_finished = True
+ pet_variables.beginning_finished = True
print()
print()
print("Your pet is currently a youngling which means it's needs a lot of attention.")
@@ -32,7 +33,7 @@ while pet_functions.is_alive():
# Start the chosen activity and go back to the activity selector.
chosen_activity = int(input("Choose the desired activity:"))
if chosen_activity == 1:
- pet_functions.feading()
+ pet_functions.feeding()
elif chosen_activity == 2:
pet_functions.playing()
elif chosen_activity == 3: