jeudi 9 septembre 2021

How do (or can) I make it so it does not allow the player to attack if the character is dead?

I want to make it so when the player (or dog) health = 0 to prevent them from doing actions and not break.

What I thought up:

elif whogetsit.lower() in playerlist and health == 0:
  print("no")
elif whogetsit.lower in doglist and doghealth == 0:
  print("no")

A little more of the code:

def elamental(item):
 global doghealth
 global health 
 global name
 global dogName
 while True:
 print(dogName + "'s health")
 print(doghealth)
 print(name + "'s health")
 print(health)
 whogetsit = input("you saw some " + item + "... BUT it was      really the " + item + " Monster!\nWho will you attack with?\n")
 if whogetsit.lower() in doglist and item == 'water':
  doghealth -= 50
  break
 elif whogetsit.lower() in playerlist and item == 'water':
   health -= 50
   break

Aucun commentaire:

Enregistrer un commentaire