My game won't update HP or MP stats every turn. Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

My game won't update HP or MP stats every turn. Why?

https://code.sololearn.com/cG52Lv3HLvPZ/#py There's my code. Im wondering why, every time the boss attacks, it doesn't deduct HP. My stats dont change at all.

29th Aug 2017, 11:48 PM
Iris Eye
Iris Eye - avatar
4 Answers
+ 8
Because you do random.randint() once only per value. For a true attack ypu need to place them in a while loop: while IrisHealth>0:
30th Aug 2017, 12:06 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
At the start of the game
30th Aug 2017, 1:31 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Where would i put the while loop? i tried twice but still couldnt figure it out.
30th Aug 2017, 1:20 AM
Iris Eye
Iris Eye - avatar
0
I tried that, then when i run it, it says it cant find the variable irisHealth. Any solution? :)
30th Aug 2017, 1:33 AM
Iris Eye
Iris Eye - avatar