adding the sound files for angry and happy sounds
This commit is contained in:
parent
ee090b61a2
commit
aa64579cbe
Binary file not shown.
|
@ -17,7 +17,7 @@ secret = randint(1, 10)
|
||||||
|
|
||||||
|
|
||||||
def pet_stats():
|
def pet_stats():
|
||||||
os.system('clear') #for Linux
|
os.system('clear')
|
||||||
print(pet_variables.pet_name)
|
print(pet_variables.pet_name)
|
||||||
print(pet_variables.pet_photo)
|
print(pet_variables.pet_photo)
|
||||||
print("Status: " + pet_variables.pet_status)
|
print("Status: " + pet_variables.pet_status)
|
||||||
|
@ -73,6 +73,8 @@ def aging():
|
||||||
def increase_hunger():
|
def increase_hunger():
|
||||||
pet_variables.pet_hunger = pet_variables.pet_hunger + 1
|
pet_variables.pet_hunger = pet_variables.pet_hunger + 1
|
||||||
|
|
||||||
|
def increase_poke_count():
|
||||||
|
pet_variables.poke_count = pet_variables.poke_count + 1
|
||||||
|
|
||||||
def increase_happiness():
|
def increase_happiness():
|
||||||
if pet_variables.pet_happiness < pet_variables.max_happiness:
|
if pet_variables.pet_happiness < pet_variables.max_happiness:
|
||||||
|
@ -98,6 +100,8 @@ def decrease_health():
|
||||||
if pet_variables.pet_health > 0:
|
if pet_variables.pet_health > 0:
|
||||||
pet_variables.pet_health = pet_variables.pet_health - 1
|
pet_variables.pet_health = pet_variables.pet_health - 1
|
||||||
|
|
||||||
|
def decrease_poke_count():
|
||||||
|
pet_variables.poke_count = pet_variables.poke_count - 1
|
||||||
|
|
||||||
# The function to decrease the stats and make the pet "live" needs to
|
# The function to decrease the stats and make the pet "live" needs to
|
||||||
# run in the background.
|
# run in the background.
|
||||||
|
@ -105,6 +109,7 @@ def decrease_stats():
|
||||||
while True:
|
while True:
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
decrease_hunger()
|
decrease_hunger()
|
||||||
|
decrease_poke_count()
|
||||||
if pet_variables.pet_hunger <= 0:
|
if pet_variables.pet_hunger <= 0:
|
||||||
decrease_health()
|
decrease_health()
|
||||||
decrease_happiness()
|
decrease_happiness()
|
||||||
|
@ -117,13 +122,14 @@ def decrease_stats():
|
||||||
# and health.
|
# and health.
|
||||||
|
|
||||||
def stroking():
|
def stroking():
|
||||||
os.system('clear') #for Linux
|
os.system('clear')
|
||||||
print()
|
print()
|
||||||
print("You're stroking the back of your pet gently.")
|
print("You're stroking the back of your pet gently.")
|
||||||
print("It makes comforting noises and leans against your hand.")
|
print("It makes comforting noises and leans against your hand.")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def feeding():
|
def feeding():
|
||||||
|
os.system('clear')
|
||||||
print("Hungriness of " + pet_variables.pet_name + ": " + pet_variables.pet_hunger * "*")
|
print("Hungriness of " + pet_variables.pet_name + ": " + pet_variables.pet_hunger * "*")
|
||||||
feeding_confirmed = input("Do you want to feed your pet?")
|
feeding_confirmed = input("Do you want to feed your pet?")
|
||||||
if feeding_confirmed in ("Y", "y"):
|
if feeding_confirmed in ("Y", "y"):
|
||||||
|
@ -133,6 +139,7 @@ def feeding():
|
||||||
# A simple guessing game which increases the pet's happiness
|
# A simple guessing game which increases the pet's happiness
|
||||||
def playing():
|
def playing():
|
||||||
guess = 0
|
guess = 0
|
||||||
|
os.system('clear')
|
||||||
while guess != secret:
|
while guess != secret:
|
||||||
g = input("Guess the Number")
|
g = input("Guess the Number")
|
||||||
guess = int(g)
|
guess = int(g)
|
||||||
|
@ -149,8 +156,18 @@ def playing():
|
||||||
# let's you poke the pet and it will talk
|
# let's you poke the pet and it will talk
|
||||||
# if you poke it more than 3 times it will get angry at you
|
# if you poke it more than 3 times it will get angry at you
|
||||||
def poking():
|
def poking():
|
||||||
print("You poke " + pet_variables.pet_name + " and it starts to speak.")
|
os.system('clear')
|
||||||
mixer.init()
|
if pet_variables.poke_count < 4:
|
||||||
mixer.music.load('sound.mp3')
|
print("You poke " + pet_variables.pet_name + " and it starts to speak.")
|
||||||
mixer.music.play()
|
pet_variables.increase_poke_count()
|
||||||
time.sleep(5)
|
mixer.init()
|
||||||
|
mixer.music.load('happy.mp3')
|
||||||
|
mixer.music.play()
|
||||||
|
time.sleep(5)
|
||||||
|
else:
|
||||||
|
print("You annoyed " + pet_variables.pet_name "It got angry at you.")
|
||||||
|
decrease_happiness()
|
||||||
|
mixer.init()
|
||||||
|
mixer.music.load('angry.mp3')
|
||||||
|
mixer.music.play()
|
||||||
|
time.sleep(5)
|
||||||
|
|
|
@ -21,3 +21,4 @@ owl = "(^0M0^)"
|
||||||
|
|
||||||
# programme variables
|
# programme variables
|
||||||
beginning_finished = False
|
beginning_finished = False
|
||||||
|
poke_count = 0
|
||||||
|
|
|
@ -29,11 +29,9 @@ while pet_functions.is_alive():
|
||||||
print()
|
print()
|
||||||
# Present the player with activities to choose from
|
# Present the player with activities to choose from
|
||||||
print("What would you like to do?")
|
print("What would you like to do?")
|
||||||
|
# Start the chosen activity and go back to the activity selector.
|
||||||
print("1: Feeding, 2: Playing, 3: Stroke Pet,")
|
print("1: Feeding, 2: Playing, 3: Stroke Pet,")
|
||||||
print("4: Stroking, 5: Show Stats,")
|
print("4: Stroking, 5: Show Stats,")
|
||||||
# Start the chosen activity and go back to the activity selector.
|
|
||||||
print("1: Feeding, 2: Playing, 3: Stroke Pet, 4: Show Stats")
|
|
||||||
# Start the chosen activity and go back to the activity selector.
|
|
||||||
try:
|
try:
|
||||||
chosen_activity = int(input("Choose the desired activity:"))
|
chosen_activity = int(input("Choose the desired activity:"))
|
||||||
if chosen_activity == 1:
|
if chosen_activity == 1:
|
||||||
|
|
Reference in New Issue