adding a pause of 1 second to the stroking function to make it more
readable
This commit is contained in:
parent
1bf51cafdf
commit
b8049a48e9
42
README.md
42
README.md
|
@ -13,7 +13,7 @@ tamagotchi programme which shouldn't be too hard:
|
|||
* ~~give it points for hungriness~~
|
||||
* ~~add the guessing game and increase the happiness by one point when you finished the game~~
|
||||
* ~~create a list with things you can do~~
|
||||
* pet it to increase happiness
|
||||
* ~~pet it to increase happiness~~
|
||||
* poke it to make it speak, pokes let it loose a happiness point
|
||||
* ~~add max values depending on the status~~
|
||||
* sleeping with all values with over 50% full heals the pet if it has lost health
|
||||
|
@ -22,25 +22,45 @@ tamagotchi programme which shouldn't be too hard:
|
|||
* ~~let it age~~
|
||||
* 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 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
|
||||
|
||||
## 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.
|
||||
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
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -93,6 +93,8 @@ def decrease_health():
|
|||
pet_variables.pet_health = pet_variables.pet_health - 1
|
||||
|
||||
|
||||
# The function to decrease the stats and make the pet "live" needs to
|
||||
# run in the background.
|
||||
def decrease_stats():
|
||||
while True:
|
||||
time.sleep(15)
|
||||
|
@ -102,9 +104,18 @@ def decrease_stats():
|
|||
decrease_happiness()
|
||||
|
||||
|
||||
### Activities ###
|
||||
|
||||
# Increases the pets hungriness by +1 unless the hunger is bigger than
|
||||
# the pet's maximum hunger. In this case the pet will vomit and looses hunger
|
||||
# and health.
|
||||
|
||||
def stroking():
|
||||
print()
|
||||
print("You're stroking the back of your pet gently.")
|
||||
print("It makes comforting noises and leans against your hand.")
|
||||
time.sleep(1)
|
||||
|
||||
def feeding():
|
||||
print("Hungriness of " + pet_variables.pet_name + ": " + pet_variables.pet_hunger * "*")
|
||||
feeding_confirmed = input("Do you want to feed your pet?")
|
||||
|
|
|
@ -6,6 +6,7 @@ pet_health = 5
|
|||
pet_age = 0
|
||||
pet_hunger = 5
|
||||
pet_happiness = 5
|
||||
pet_stomach = 0
|
||||
|
||||
# age based max values
|
||||
max_health = 5
|
||||
|
|
|
@ -29,7 +29,7 @@ while pet_functions.is_alive():
|
|||
print()
|
||||
# Present the player with activities to choose from
|
||||
print("What would you like to do?")
|
||||
print("1: Feeding, 2: Playing, 3: Show Stats")
|
||||
print("1: Feeding, 2: Playing, 3: Stroke Pet, 4: Show Stats")
|
||||
# Start the chosen activity and go back to the activity selector.
|
||||
chosen_activity = int(input("Choose the desired activity:"))
|
||||
if chosen_activity == 1:
|
||||
|
@ -37,5 +37,7 @@ while pet_functions.is_alive():
|
|||
elif chosen_activity == 2:
|
||||
pet_functions.playing()
|
||||
elif chosen_activity == 3:
|
||||
pet_functions.stroking()
|
||||
elif chosen_activity == 4:
|
||||
pet_functions.pet_stats()
|
||||
print("Your pet died.")
|
||||
|
|
Reference in New Issue