So I wanted to create a live composite image, where part of the image position can be changed depending on the condition. Consider this case:
I want to make a character , composed by the body and the hat. Now if the body size is small, of course I want the position of the hat to be adjusted also depending on the head positin.
I made a global variable named body size, and give the default value "big", let say.
Code: Select all
define body_size = "big"
Code: Select all
body = ConditionSwitch(...) # some if condition to switch between the body size value
image side char sample = LiveComposite(
(317,600),
(0, 0), body,
hat_position(), "hat.png")
And I define function, named hat_position() like
Code: Select all
init python:
def hat_position():
global body_size
if body_size == "big":
return (200, 225)
else:
return (200, 155)
Note that the body size ConditionSwitch is working as expected. Which means the variable value is already changed, and also I checked on python console, typing the conditional value and it is working as expected.
Do I miss something here? I suspect that I misunderstood something quite fundamental..
Any helps is truly appreciated. Thanks!