diff --git a/.README.md.swp b/.README.md.swp new file mode 100644 index 0000000..7ee7870 Binary files /dev/null and b/.README.md.swp differ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.pet_functions.py.swp b/.pet_functions.py.swp new file mode 100644 index 0000000..867a208 Binary files /dev/null and b/.pet_functions.py.swp differ diff --git a/README.md b/README.md index dc7b0ed..530d9d4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ funciton more readable * add a function which lets the tamagotchi age (one week as a youngling, three weeks as an adult and two weeks as an elderly) ## 30.6.2015 -Time function has to be implemented otherwise the decrease.* functions +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. diff --git a/README_conflict-20150712-220614.md b/README_conflict-20150712-220614.md deleted file mode 100644 index 4ad6fd9..0000000 --- a/README_conflict-20150712-220614.md +++ /dev/null @@ -1,58 +0,0 @@ -# tamagotchi - -## Todo -* adding a function to decrease the health - -## Possible things to add -Some interesting things I could add to the -tamagotchi programme which shouldn't be too hard: - -* poke it to make it speak, pokes let it loose a happiness point -* sleeping with all values with over 50% full heals the pet if it has lost health -* add pooping and cleaning function -* let it get sick if it's health is low, by random chance or if there's too much poop -* decrease the hunger value after x seconds -* add sleep function, you have to switch the lights off otherwise it will have nightmare and loose one health point. -* add the possibility to get sick. Maybe compare two random numbers. -* add a function to restart the game or exit it after the pet died. -* add a function let the user exit the game -* safe the stats in a text file -* make a seperate function for each age because it makes the aging -funciton more readable -* add a function which lets the tamagotchi age (one week as a youngling, three weeks as an adult and two weeks as an elderly) - -## 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. - -Moved all the imports to there relevant place -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. - -## 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 -I've fixed the decrease_stats function. However I wanted that it only -starts after the beginning is finished. So that the pet doesn't start -with a disadvantage. I currently don't know how to fix this. For the -moment it will work like this. I could add a function to the beginning -which resets the stats back to the default values. Might be a good work- -around however for the future I would like how to do it properly. - -## 08.07.2015 -The feature to the pet the pet will be so that it only prints a message. -It wouldn't be fun if it would increase happiness because that would be -too easy. - diff --git a/__pycache__/.gitignore b/__pycache__/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc b/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc deleted file mode 100644 index abf2279..0000000 Binary files a/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc and /dev/null differ diff --git a/__pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc b/__pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc deleted file mode 100644 index 4456677..0000000 Binary files a/__pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc and /dev/null differ diff --git a/pet_functions.py b/pet_functions.py index 71818ae..37f29f3 100644 --- a/pet_functions.py +++ b/pet_functions.py @@ -31,11 +31,8 @@ def pet_stats(): # A function which checks if the pet is still alive def is_alive(): - if pet_variables.pet_health > 0: - return True - else: - return False - + return pet_variables.pet_health > 0: + # A function which let's the player choose his pet. def beginning(): @@ -60,7 +57,7 @@ def set_youngling_stats(): pet_variables.max_health = 10 pet_variables.max_happiness = 8 pet_variables.max_hunger = 7 - + def set_adult_stats(): pet_variables.max_health = 10 pet_variables.max_happiness = 8 @@ -70,7 +67,7 @@ def set_elderly_stats(): pet_variables.max_health = 7 pet_variables.max_happiness = 5 pet_variables.max_hunger = 10 - + def reset_stats(): pet_variables.pet_health = pet_variables.max_health pet_variables.pet_happiness = pet_variables.max_happiness @@ -93,40 +90,40 @@ def aging(): def increase_hunger(): if pet_variables.pet_hunger < pet_variables.max_hunger: - pet_variables.pet_hunger = pet_variables.pet_hunger + 1 + pet_variables.pet_hunger += 1 def increase_poke_count(): - pet_variables.poke_count = pet_variables.poke_count + 1 + pet_variables.poke_count += 1 def increase_happiness(): if pet_variables.pet_happiness < pet_variables.max_happiness: - pet_variables.pet_happiness = pet_variables.pet_happiness + 1 + pet_variables.pet_happiness += 1 def increase_health(): if pet_variables.pet_health < pet_variables.max_health: - pet_variables.pet_health = pet_variables.pet_health + 1 + pet_variables.pet_health += 1 def decrease_hunger(): if pet_variables.pet_hunger > 0: - pet_variables.pet_hunger = pet_variables.pet_hunger - 1 + pet_variables.pet_hunger -= 1 def decrease_happiness(): if pet_variables.pet_happiness > 0: - pet_variables.pet_happiness = pet_variables.pet_happiness - 1 + pet_variables.pet_happiness -= 1 def decrease_health(): if pet_variables.pet_health > 0: - pet_variables.pet_health = pet_variables.pet_health - 1 + pet_variables.pet_health -= 1 def decrease_poke_count(): - pet_variables.poke_count = pet_variables.poke_count - 1 + pet_variables.poke_count -= 1 # The function to decrease the stats and make the pet "live" needs to