rfpotrero / The-Gem-in-the-Tower

0 stars 1 forks source link

Fix bug where after combat menu was appear even if player was dead #12

Closed rfpotrero closed 2 years ago

rfpotrero commented 2 years ago

Code before the fix. while tower_floor <= 5: print("After climbing the stairs you arrive to the first floor") encounter(player_character) if player_character.hp == 0: print("You are DEAD game Over") after_combat() print(f"Floor number: {tower_floor}") tower_floor = tower_floor + 1

rfpotrero commented 2 years ago

There was a break statement missing to break the loop if the player was dead.

Fixed code below:

  while tower_floor <= 5:
        print("After climbing the stairs you arrive to the first floor")
        encounter(player_character)
        if player_character.hp == 0:
            print("You are DEAD game Over")
            break
        after_combat()
        print(f"Floor number: {tower_floor}")
        tower_floor = tower_floor + 1