class.rpy
Code: Select all
class NPC(object):
def __init__(self, name, niceName, location, hours, minutes, lbt=""):
self.name = name
self.niceName = niceName
self.location = location
self.hours = hours
self.minutes = minutes
self.lbt = lbt
@property
def avatar(self):
global hours
global minutes
global location
avtr = "avatar/{}_{}_{}_{}.png".format(self.name, str(hours), str(minutes), location)
if renpy.loadable(avtr):
return avtr
else:
return "avatar/empty.png"
character_screen.rpy
Code: Select all
screen charcater_screen():
for q in NPCS:
if q.location == location:
imagebutton:
idle q.avatar
hover q.avatar
focus_mask True
action SetVariable("mainUI", False), Call(q.lbt)
default.rpy
Code: Select all
default hours = 0
default minutes = 0
default lbt = ""
default NPCS = []
label InitialiseVariables:
$ NPCS.append(NPC("mom", "Mom", "livingroom", 12, 0, lbt="test"))
return