本帖最后由 鼠西 于 2019-8-6 22:48 编辑
切换的问题是暂时解决了,每次更新变量都要重新show一次立绘才行,大概是因为需要刷新可视组件?
但是又出现了新的问题——
为了能够替换不同嘴型的说话动态所以用了DynamicDisplayable,因为发现在Livecomposite中用转义符并不能改变图片显示...(即使刷新立绘也一样)
但在Dynamic中眨眼变得非常鬼畜....经试验发现凡是带了choice的image都会这样,没有带的就一切正常
鬼畜眼睛示意短视频(百度网盘)https://pan.baidu.com/s/1djEMCA_y_SCEiBKOU1Yhfw
下面是代码和眼睛的示意(右边的眼睛是正常显示的样子)
目前感觉有几个方向:
1、解决choice和Dynamic的冲突?
2、把有关变更嘴巴类型的变量,传入事先定义的一系列speak函数的某个地方?
3、运用其他的办法实现间隔的随机性?
不过都不知道要怎么解决……纠结一天了OTZ
(PS:嘴巴动态是从LSF论坛上搬运修改的,原作者ID:kinmoku)
[RenPy] 纯文本查看 复制代码 init python:
# This is set to the name of the character that is speaking, or
# None if no character is currently speaking.
speaking = None
# This returns speaking if the character is speaking, and done if the
# character is not.
def while_speaking(name, speak_d, done_d, st, at):
if speaking == name:
return speak_d, .1
else:
return done_d, None
# Curried form of the above.
curried_while_speaking = renpy.curry(while_speaking)
# Displays speaking when the named character is speaking, and done otherwise.
def WhileSpeaking(name, speaking_d, done_d=Null()):
return DynamicDisplayable(curried_while_speaking(name, speaking_d, done_d))
# This callback maintains the speaking variable.
def speaker_callback(name, event, **kwargs):
global speaking
if event == "show":
speaking = name
elif event == "slow_done":
speaking = None
elif event == "end":
speaking = None
# Curried form of the same.
speaker = renpy.curry(speaker_callback)
motion = 1
eyes = 1
mayu = 1
def draw_BB(st,at):
return LiveComposite(
(433, 1004), # size of composition
(0,0),"BB_base.png", # default sprite
(0,0),"BBeyes_%d"%eyes, # blinking animation
(0,0),WhileSpeaking("BB", "BB_speak%d"%motion, "BB_mouse_close%d.png"%motion), # lip sync (character callback speaker, animation, and closed mouth.)
(0,0),"BB_mayu%d.png"%mayu,
),.1
image BBspeaking = DynamicDisplayable(draw_BB)
|