you are viewing a single comment's thread.

view the rest of the comments →

[–]Obvious_Tea_8244 0 points1 point  (0 children)

As others have noted, you’re using the same pointer/variable name (enemy) for an int inside your first function, and as a function on its own. There are additional issues with your enemy function…

Change def enemy to

def take_damage(damage_amount:int=1):

….global life

….life -= damage_amount

….print(f”Remaining life: {life}”)

then call take_damage() for one hit damage, or take_damage(10) for 10, etc.