while True:
attack_choice = input("Enter '1' to attack: ")
if attack_choice == '1':
goblin_health = 150
player_power = random.randint(15,25)
goblin_damage = random.randint(15,30)
goblin_health -= player_power
player_health -= goblin_damage
print(f"{BLUE}You did {player_power} damage to enemy. He hp is now {goblin_health} hp ")
print(f"The enemy did {goblin_damage} damage to you and your hp is now {player_health} hp")
if goblin_health <= 0:
print(f"You defeated the enemy! ")
break
elif player_health <= 0:
print(f"You def
#๐ help with debug
25 messages ยท Page 1 of 1 (latest)
@subtle storm
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
Enter '1' to attack: 1
You did 24 damage to enemy. He hp is now 126 hp
The enemy did 21 damage to you and your hp is now 110 hp
Enter '1' to attack: 1
You did 20 damage to enemy. He hp is now 130 hp
The enemy did 18 damage to you and your hp is now 92 hp
Enter '1' to attack: 1
You did 18 damage to enemy. He hp is now 132 hp
The enemy did 19 damage to you and your hp is now 73 hp
```this is output
i honestly dont know why it adds instead of subtract
second dungeon btw everything else is fixed and working
i dont know why ur code isnt working. maybe you should print out the enemy health before you subtract it.
and see the diff
ok
Enter '1' to attack: 1
150
You did 18 damage to enemy. He hp is now 132 hp
The enemy did 18 damage to you and your hp is now 159 hp
Enter '1' to attack: 1
150
You did 18 damage to enemy. He hp is now 132 hp
The enemy did 28 damage to you and your hp is now 131 hp
Enter '1' to attack: 1
150
You did 24 damage to enemy. He hp is now 126 hp
The enemy did 21 damage to you and your hp is now 110 hp
Enter '1' to attack:
```the 150 is the enemy hp
for the first one it works but then no
Hmmm
i get it i think
yes total mastermind
You did 16 damage to enemy. He hp is now 134 hp
The enemy did 17 damage to you and your hp is now 78 hp
Enter '1' to attack: 1
134
You did 18 damage to enemy. He hp is now 116 hp
The enemy did 19 damage to you and your hp is now 59 hp
Enter '1' to attack: 1
116
You did 24 damage to enemy. He hp is now 92 hp
The enemy did 21 damage to you and your hp is now 38 hp
Enter '1' to attack: 1
92
You did 15 damage to enemy. He hp is now 77 hp
The enemy did 15 damage to you and your hp is now 23 hp
Enter '1' to attack: 1
77
You did 18 damage to enemy. He hp is now 59 hp
The enemy did 22 damage to you and your hp is now 1 hp
```it works ...i lost yes
I need more hp
Ok lets go everything works
this is good progress
ty
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.