- Jun 15, 2022
- 11
- 18
Alright so, I'm trying to figure out how to do this exactly. I see there are some threads already about this kind of but I'm doing it a different way so I'm hoping someone can help.
So I'm storing a few variables within a class
Now I've created another script and menu thingy to display variables however, I get an error doing it this way. The error that I get says "NameError: name 'self' is not defined"
Now the only thing I found on here is when people do the typical method like
however that doesn't work in my case, so if anyone can help me that would be amazing.
So I'm storing a few variables within a class
Code:
class Actor:
def __init__(self, character, name, trust, health, thirst, affection, threat):
self.c = character
self.name = name
self.trust = trust
self.health = health
self.thirst = thirst
self.affection = affection
self.threat = threat
Code:
screen StatsUI:
frame:
xalign 0.5
yalign 0.5
xpadding 30
ypadding 30
hbox:
spacing 40
vbox:
spacing 10
text "Thirst" size 40
vbox:
spacing 10
text str(self.thirst) size 40
Code:
define health = 100
vbox:
text "[health]"