2
Help! How do you add lives in code!
kirbyfire (1)

Right now, I am starting to work on a project, (no animations, all just text), Can someone tell me how I can make a life system so If you get an incorrect answer, you lose a life? This is in Python. Thanks!

You are viewing a single comment. View All
Answered by ebest (405) [earned 5 cycles]
View Answer
4
ebest (405)

Also, you really should add better option detection, like if a option is not valid, you say so.

And maybe you should add dictionaries. I used to love to do text adventures, then I realized dictionaries were simple combined with arrays.

1
kirbyfire (1)

@ebest, Also, how do you keep the lives consistent so that it doesn't always give you 3 lives at the beginning of a puzzle?

1
1
kirbyfire (1)

@ebest I tested it out, but if I get a wrong answer, (but then get one correct and move on) and then do the same thing again, Then instead of having only one life, I have 2. How do I fix this? (If you can't understand my question, try getting one wrong and then correct twice in a row, then get it wrong. Instead of ending it it gives another chance.)

1
kirbyfire (1)

@ebest and also, how do you give multiple correct answers that lead to different paths? I tried using the or function but it didn't work!

4
ebest (405)

@kirbyfire

if a in ["a", "A"]:
    pass

Also:
USE

player_health -= 1
4
ebest (405)

@kirbyfire What programming languages have you learned before?

1
kirbyfire (1)

@ebest A bit of Java, and Python

4
ebest (405)

@kirbyfire you can reset the input every time. Change it.