Fix global var bug
This commit is contained in:
parent
37a70d73dc
commit
9dcb86f9f9
6
main.py
6
main.py
|
@ -123,7 +123,7 @@ def interact_with_student():
|
|||
|
||||
# Main game loop
|
||||
def play_game():
|
||||
global player_hunger, player_health, player_inventory
|
||||
global player_name, player_hunger, player_health, player_inventory
|
||||
# Introduction
|
||||
sprint("Welcome to Next Dining: The Video Game!")
|
||||
sprint("What is your name?")
|
||||
|
@ -151,12 +151,12 @@ def play_game():
|
|||
display_status()
|
||||
else:
|
||||
sprint("Invalid action. Please try again.")
|
||||
|
||||
|
||||
# Hunger and health decrement
|
||||
player_hunger += 5
|
||||
if chef_angry:
|
||||
player_health -= 10
|
||||
|
||||
|
||||
# Check for game over
|
||||
if player_health <= 0:
|
||||
sprint("Your health has reached zero. Game over.")
|
||||
|
|
Loading…
Reference in New Issue