How to update value in class in other module?

Viewed 40

I got problem, I don't know, why my value

file name:

game_stage_chest_open.py

from game_character import Rycerz
from game_character import Bohater

     else:
        rycerz = Bohater()
        rycerz.zdrowie = rycerz.zdrowie + 10
        print(rycerz.zdrowie)

game_character.py

class Bohater:
    def __init__(self, zdrowie=0, mana=0, stamina=0, poziom=1, doswidaczenie=0):
        self.zdrowie = zdrowie
        self.mana = mana
        self.stamina = stamina
        self.poziom = poziom
        self.doswiadczenie = doswidaczenie

    def informacje_o_postaci(self):
        character_info = (
            f"Twoja Postać posiada na początku gry:\n [{self.zdrowie}] punktów zdrowia,\n [{self.mana}] punktów many,\n [{self.stamina}] punktów staminy")
        return character_info


class Rycerz(Bohater):
    def __init__(self):
            super().__init__(zdrowie=0, mana=0, stamina=0, poziom=1, doswidaczenie=0)
        self.zdrowie = 200
        self.mana = 150
        self.stamina = 200

When I print, all time I get:

10
10

Should be:

   10
   20
   30
0 Answers
Related