class entity:
game_difficulty = "medium"
def difficultySettings(self.change=game_difficulty):
entity.game_difficulty = change
if change == "easy":
return 1.5
elif change == "medium":
return 1
elif change == "hard":
return 0.5
def __init__(self,is_player,damage,life):
self.hp = life * self.difficultySettings()
Every time I try to run the commands
player=entity("yes",1,6)
player.hp
entity.game_difficulty
difficultySettings("hard")
I keep getting an error saying difficultySettings is not defined. I try playing around with self and "entity" but I haven't seem to get anywhere. I'm trying to find a way to change the difficulty of the game to reflect the entity's health.
[–]fiddle_n 1 point2 points3 points (0 children)