Ask coding questions

← Back to all posts
Certain problem
NathanWeems

So when I type fireball, it's draining HP until it is at 0 instead of just once and I'm not sure how to fix it

Voters
NathanWeems
Comments
hotnewtop
LukeWright

why don't you make it so that everytime you take a chunk of health, it sets the choice variable to an empty string so that it only triggers once?
you would do it like this:

also, to save time instead of writing

, you could just write

NathanWeems

@LukeWright Alright, thank you

LukeWright

Click the checkmark next to my comment if I gave you the correct answer! @NathanWeems

NathanWeems

@LukeWright It didn't fix it. When I type "water blast" one time, it says invalid input forever

LukeWright

there must be something wrong with your input statement. Try putting something in it like

or try retyping the input statement and specifying which variable type you would like to use

@NathanWeems

NathanWeems

@LukeWright Still doing the infinite "invalid inputs" and then when I do fireball it drains everything instantaneously

IGamer123

Firstly I don't know python with turtle so sorry bout that
second, this happens -

NathanWeems

@IGamer123 The turtle is just for animations, the actual Python should be the exact same

IGamer123