'Text-based Story/Adventure'
I just need the fight to end and perform other functions depending on the player or bandits having a hp level == 0. I have a class called Player() and p1 and bandits are two separate instances of the class with a starting hp of 2. "self.hp = 2"
I'd like to point out that bandits are 'two' people in the story, but they make up 'one' instance in the class 'Player'. That is on purpose. It's a story not supposed to challenge you to much. I could use some help getting beyond the fight.
I get this in the console:
Early in the morning, you are startled so bad you shoot up out of your blanket!
You hear a ruckus in the wagon next to you and find a couple of bandits
sneaking off with the food the whole wagon train eats from.
You've got to do something fast. There are only two of em, and they look pretty scrawny.
[A] Fight like a man. Save the food supply.
[B] Holler for help from the nice lady in the wagon over yonder... then run away.
[M] View Map
[I] View Bag
*************************
What are you gonna do?
>a
--- FIGHT THE BANDITS! ---
1) Left hook
2) Right hook
3) Spur em with your boots!
Pick a move
> 3
You got em good. Both bandits are lookin' skeerd now!
--- FIGHT THE BANDITS! ---
1) Left hook
2) Right hook
3) Spur em with your boots!
Pick a move
> 2
You got em good. Both bandits are lookin' skeerd now!
Process finished with exit code 0
This is the code: How can I continue to the next scene.
### FIGHT FUNCTION ### (TRIGGER UNLOCK) ###
def fight():
if p1.hp == 0:
bandits_won
elif bandits.hp == 0:
p1_won
else:
pass
while p1.hp > 0 and bandits.hp > 0:
print(" --- FIGHT THE BANDITS! --- ")
print("1) Left hook\n2) Right hook\n3) Spur em with your boots!\n\n")
act = int(input("Pick a move\n> "))
if act in range(1,4):
bandits.hp -= 1
print("You got em good. Both bandits are lookin' skeerd now!")
continue
else:
print("That wasn't an option bozo! You got a knuckle sandwich and lost [1] HP!")
p1.hp -= 1
print("You have ", p1.hp, " HP left! Don't miss again!!!")
continue
p1_won = False
bandits_won = False
if p1_won == True:
print("You got them suckers. The wagon train is grateful. You grab a bite for your trouble.")
p1.hp = 2
scene3()
elif bandits_won == True:
delay_print("They knocked you out cold, took the food, and the whole wagon train suffered. Croup took the "
"child...\n")
delay_print("You failed your mission. No sense in going on now!")
main_menu()
Aucun commentaire:
Enregistrer un commentaire