I keep trying to run a code for a game, but I keep getting a SyntaxError on my if statement, and in the terminal, it keeps pointing at the colon. I am not sure why, and I am just a beginner so I understand if it is weird. Note that the code, has no indentation problems, it is just the copy and pasting.
I've tried using integers and strings, but nothing works. I am not sure what to do.
while monster.enemyhealth>0: print ("[Your Turn]") print ("(1) Smash") print ("(2) "+player.secondary_attack) print ("(3) "+player.tertiary_attack) print ("(4) Backpack") print ("(5) Escape Battle") battleinput=int(input(">>>")
if battleinput==1:
monster.enemyhealth-player.primary_attack.damage=monster.enemyhealth
print ("You did "+smash.damamge+" to the monster!")
player.powerpoints-player.primary_attack.powerpointcost=player.powerpoints
player.health-monster.attackpower=player.health
print ("The monster did "+str(monster.attackpower)+" to you!")
And here's what the error is: File main.py, line 140 if battleinput==1: ↑ SyntaxError: invalid syntax
I expect it to just go over, and the program to run normally.
Aucun commentaire:
Enregistrer un commentaire