adding a function to poke the pet

This commit is contained in:
Andreas Zweili 2015-07-12 21:10:36 +02:00
parent 128db7946b
commit 44f4428019
6 changed files with 38 additions and 28 deletions

View File

@ -1,31 +1,25 @@
# tamagotchi
## Todo
* make the aging work parallel the main programme
* 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:
* ~~create a loop~~
* ~~give it happiness~~
* ~~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~~
* 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
* 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
* ~~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 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

View File

@ -1,17 +1,15 @@
import pet_variables
import time
from random import randint
import os
from pygame import mixer
# Pictures and symboles used ingame
cat = "(=^o.o^=)__"
mouse = "<:3 )~~~~"
fish = "<`)))><"
owl = "(^0M0^)"
# variables needed for the guessing game
secret = randint(1, 10)
def pet_stats():
os.system('clear') #for Linux
print(pet_variables.pet_name)
print(pet_variables.pet_photo)
print("Status: " + pet_variables.pet_status)
@ -35,13 +33,13 @@ def beginning():
print("1: Cat, 2: Mouse, 3: Fish, 4: Owl")
chosen_pet = int(input("Choose your pet:"))
if chosen_pet == 1:
pet_variables.pet_photo = cat
pet_variables.pet_photo = pet_variables.cat
elif chosen_pet == 2:
pet_variables.pet_photo = mouse
pet_variables.pet_photo = pet_variables.mouse
elif chosen_pet == 3:
pet_variables.pet_photo = fish
pet_variables.pet_photo = pet_variables.fish
elif chosen_pet == 4:
pet_variables.pet_photo = owl
pet_variables.pet_photo = pet_variables.owl
pet_variables.pet_name = input("How do you want to call your pet?")
@ -111,8 +109,11 @@ def decrease_stats():
# and health.
def stroking():
os.system('clear') #for Linux
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 * "*")
@ -136,3 +137,12 @@ def playing():
print("Too low")
increase_happiness()
print("Game over!")
# let's you poke the pet and it will talk
# if you poke it more than 3 times it will get angry at you
def poking():
print("You poke " + pet_variables.pet_name + " and it starts to speak.")
mixer.init()
mixer.music.load('sound.mp3')
mixer.music.play()
time.sleep(5)

View File

@ -6,7 +6,7 @@ pet_health = 5
pet_age = 0
pet_hunger = 5
pet_happiness = 5
pet_stomach
pet_stomach = 0
# age based max values
max_health = 5

View File

@ -29,15 +29,21 @@ 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,")
print("4: Stroking, 5: 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:
pet_functions.feeding()
elif chosen_activity == 2:
pet_functions.playing()
elif chosen_activity == 3:
pet_functions.stroking()
elif chosen_activity == 4:
try:
chosen_activity = int(input("Choose the desired activity:"))
if chosen_activity == 1:
pet_functions.feeding()
elif chosen_activity == 2:
pet_functions.playing()
elif chosen_activity == 3:
pet_functions.stroking()
elif chosen_activity == 4:
pet_functions.poking()
elif chosen_activity == 5:
pet_functions.pet_stats()
except ValueError:
pet_functions.pet_stats()
print("Your pet died.")