At some parts of my code its just stop and doesn't go back to the move(). I want it to add the score and i did that with score = score + 100 BUT it just disrupts the code ;-;. Its a bit messy and i'm sorry about that but please help I have NO clue why it does this. Fyi I'm using this code on pythonroom if that helps.
import random
weapon = "Wooden Sword"
Damage0 = 1
Damage1 = 8
Speed = 6
lives = 5
score = 0
gold = 80
armor = "Nothing"
health = 20
def please():
name = input("Please put a name and not nothing.")
if name == "":
please1(name)
else:
yon(name)
def please1(name):
name = input("Please put a name and not nothing.")
if name == "":
please1(name)
else:
yon1(name)
def yon(name):
print("So your name is " + name + "?")
yon = input("Is this your name? ''" + name + "'' [Yes] or [No]?")
if yon == "Yes":
begining()
elif yon == "yes":
begining()
else:
sorry(name)
def yon1(name):
yon = input("Is this your +name? ''" + name + "'' [Yes] or [No]?")
if yon == "Yes":
begining()
elif yon == "yes":
begining()
else:
sorry1(name)
def sorry(name):
print(" ")
print("I'm sorry, so what is your name?")
print(" ")
name = input("What is you name?")
if name != "":
yon(name)
else:
please1(name)
def sorry1(name):
name = input("What is you name?")
if name != "":
yon1(name)
else:
please1(name)
def move():
Next = input("Will you go and fight a monster or check stats or quit the game? [Fight] [Stats] [Travel] [Quit]")
Next = Next.lower()
if "tat" in Next:
Stats()
elif "ight" in Next:
Fight()
elif "ravel" in Next:
travel()
elif "uit" in Next:
print("As you quit the game your character disapears...")
else:
move()
def Fight():
your_speed = Speed
enemy_speed = 2
if enemy_speed >= your_speed:
print("The " + enemy + " is faster, it goes first!")
enemy_first()
else:
print("You're faster and get to go first!")
your_first()
def end(enemy_health,your_health):
if your_health > 0:
print(" ")
print("You defeat the Ork")
score = score + 100
gold = gold + 50 'it stops here and won't continue why?
print(gold)
print(score)
move()
else:
print("The ork beat you!")
move()
def your_first():
enemy_health = 20
your_health = health
while your_health > 0 and enemy_health > 0:
your_damage = random.choice(range(Damage0, Damage1))
enemy_health -= your_damage
if enemy_health <= 0:
enemy_health = 0
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("Enemy's health:" + str(enemy_health))
end(enemy_health,your_health)
else:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("Enemy's health:" + str(enemy_health))
enemy_damage = random.choice(range(3, 12))
your_health -= enemy_damage
if your_health <= 0:
your_health = 0
print(" ")
print("Ork dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
end(enemy_health,your_health)
else:
print(" ")
print("Ork dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
def enemy_first():
enemy_health = 20
your_health = health
while your_health > 0 and enemy_health > 0:
enemy_damage = random.choice(range(3, 12))
your_health -= enemy_damage
if your_health <= 0:
your_health = 0
print(" ")
print("Ork dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
end(enemy_health,your_health)
else:
print(" ")
print("Ork dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
your_damage = random.choice(range(Damage0, Damage1))
enemy_health -= your_damage
if enemy_health <= 0:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("Enemy's health:" + str(enemy_health))
end(enemy_health,your_health)
else:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("Enemy's health:" + str(enemy_health))
def Stats():
if weapon == "Wooden Sword":
Damage = 1, 8
Damage0 = 1
Damage1 = 8
Speed = 6
if weapon == "Rusty Sword":
Damage = 13, 17
Damage0 = 13
Damage1 = 17
Speed = 4
if weapon == "Bow":
Damage = 2, 13
Damage0 = 2
Damage1 = 13
Speed = 10
if weapon == "Bronze Sword":
Damage = 18, 24
Damage0 = 18
Damage1 = 24
Speed = 1
if weapon == "Magic Spell":
Damage = 25, 33
Damage0 = 25
Damage1 = 33
Speed = 10
if armor == "Nothing":
health = 20
print(" ")
print(" ")
print("(+)~~~~~~~~~~~~~~~~~~~~~~")
print(" | Your | Health: ")
print(" | Stats | " + str(health) + " ")
print(" |----------------------- ")
print(" | Weapon Stats: ")
print(" | Damage: "+str(Damage)+" ")
print(" | Speed: "+str(Speed)+" ")
print("(+)~~~~~~~~~~~~~~~~~~~~~~")
print(" Your Score:"+ str(score) +" ")
print(" ")
print(" ")
move()
def begining():
print(" ")
print("Welcome to the nexus!")
print("It is the center of this world.")
print("It is also called the hub.")
print("During the game you can gather items and get xp")
print("At the end of the game you can see your score based")
print("on how well you did and how many items you found!")
move()
def travel():
travel = input("Where will you travel to? [Cave] [Market] [Boss]")
if "ve" in travel:
cave()
elif "et" in travel:
market()
elif "ss" in travel:
Boss_fight()
else:
move()
def cave():
print("pie")
def market():
print("pie")
def Boss_fight():
your_speed = Speed
enemy_speed = 2
if enemy_speed >= your_speed:
print("The " + enemy + " is faster, it goes first!")
Boss_Boss_first
else:
print("You're faster and get to go first!")
Boss_Your_First()
def Boss_end(enemy_health,your_health):
if your_health > 0:
print(" ")
print("You defeat The Boss")
score = score + 2000
move()
else:
print(" ")
if lives == 3 or lives == 2 or lives == 1:
print("The Boss beats you!")
lives = lives - 1
print("You have " + str(lives) + " left")
move()
else:
start= input("Restart or Quit?")
if "start" in start or "try" in start:
reset(xp,lvl,weapon)
else:
print(" ")
def Boss_Your_First():
enemy_health = 50
your_health = health
while your_health > 0 and enemy_health > 0:
your_damage = random.choice(range(Damage0, Damage1))
enemy_health -= your_damage
if enemy_health <= 0:
enemy_health = 0
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("The Boss's health:" + str(enemy_health))
Boss_end(enemy_health,your_health)
else:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("The Boss's health:" + str(enemy_health))
enemy_damage = random.choice(range(15, 19))
your_health -= enemy_damage
if your_health <= 0:
your_health = 0
print(" ")
print("The Boss dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
Boss_end(enemy_health,your_health)
else:
print(" ")
print("The Boss dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
def Boss_Boss_first():
enemy_health = 50
your_health = health
while your_health > 0 and enemy_health > 0:
enemy_damage = random.choice(range(15, 19))
your_health -= enemy_damage
if your_health <= 0:
your_health = 0
print(" ")
print("The Boss dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
Boss_end(enemy_health,your_health)
else:
print(" ")
print("The Boss dealt " + str(enemy_damage) + " damage!")
print("Your health:" + str(your_health))
your_damage = random.choice(range(Damage0, Damage1))
enemy_health -= your_damage
if enemy_health <= 0:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("The Boss's health:" + str(enemy_health))
Boss_end(enemy_health,your_health)
else:
print(" ")
print("You dealt " + str(your_damage) + " damage!")
print("The Boss's health:" + str(enemy_health))
print(" ")
print("Hello. What is your name?")
print(" ")
name = input("What is you name?")
if name == "":
please()
else:
yon(name)
Aucun commentaire:
Enregistrer un commentaire