I\'m learning python and am trying to write a wound system based on hot zones of a character. Here\'s what I\'ve written. Don\'t judge me too much.
class Charact
You define l_arm
in function and its local to that function only. It has scope of function only. That can be accessed inside function only.
You try to access l_arm
outside function, and that gives error, l_arm
is not defined.
If you want to access all these variable outside function, you can define it above class
#Hit Zones
l_arm=[]
r_arm=[]
l_leg=[]
r_leg=[]
hit_region_list = [l_arm , r_arm, l_leg, r_leg]
#Wound Pretty Names
healthy = "Healthy"
skin_cut = "Skin Cut"
muscle_cut = "Muscle Cut"
bone_cut = "Exposed Bone"
class Character:
...
...
...
john = Character(34, 33, 33)
john.hit(l_arm, skin_cut)
This will work.