[solved] finding transforms based on name
Posted: Mon Dec 06, 2021 2:42 pm
Hello,
In my point & click game the player walks into different rooms. Depending on multiple variables different things will be displayed in these rooms.
Between 0 and 3 characters will be shown in a room. I would like these characters to stand neatly next to eachother in the bottomleft of the screen. Which I can do with the following transforms:
I get an npc and add the 'slot0' transform to it in a tuple, later on when I build the screens I use this transform to position the npc at the right place.
the npc object:
and the screen:
I would like to implement the following code:
As you see in the code it's not clear to me how I can get a transform object when I still need to 'create' it's name with the teller. Can anyone send me in the right direction?
Thank you in advance
In my point & click game the player walks into different rooms. Depending on multiple variables different things will be displayed in these rooms.
Between 0 and 3 characters will be shown in a room. I would like these characters to stand neatly next to eachother in the bottomleft of the screen. Which I can do with the following transforms:
Code: Select all
init:
transform slot0:
zoom 0.40
ypos 0.38
transform slot1:
zoom 0.40
ypos 0.38
xpos 0.15
transform slot2:
zoom 0.40
ypos 0.38
xpos 0.30
the npc object:
Code: Select all
npcWithSlot = (npc, slot0)
Code: Select all
screen BodyScreen(npcWithSlot):
imagebutton:
idle npcWithSlot[0].GetUIName()
focus_mask True
action Call("interact", "npc", npcWithSlot[0])
at npcWithSlot[1]
Code: Select all
self.npcWithSlotArray = []
teller = 0
for npc in world.npcArray:
slotToUse = # something like slot + teller?
npcWithSlot = (npc, slotToUse)
self.npcWithSlotArray.append(npcWithSlot)
teller = teller + 1
Thank you in advance