感謝回覆..原本的問題已經解決了.但是又產生了一個新的問題.......先上代碼
[RenPy] 纯文本查看 复制代码 init python:
def action_atl_creator(trans, times):
# p1_chara_motion_type 5 上下
if trans=="5":
if times == "1":
return up_and_down_1
if times == "2":
return up_and_down_2
# p1_chara_motion_type 2 左右
if trans=="2":
if times == "1":
return left_and_right_1
if times == "2":
return left_and_right_2
return trans_default
init:
transform trans_default:
yalign 0
transform left_and_right_1:
yalign 0
linear 0.075 xalign -0.01
linear 0.15 xalign 0.01
linear 0.15 xalign -0.01
linear 0.075 xalign 0
transform left_and_right_2:
yalign 0
linear 0.075 xalign -0.01
linear 0.15 xalign 0.01
linear 0.15 xalign -0.01
linear 0.075 xalign 0
repeat 2
transform up_and_down_1:
linear 0.15 yalign 0.02
linear 0.15 yalign 0
transform up_and_down_2:
linear 0.15 yalign 0.02
linear 0.15 yalign 0
repeat 2
[RenPy] 纯文本查看 复制代码 $ count = 0
$ my_script = load_json()
while count < len(my_script):
$ chara_voice = get_voice(count,my_script[count],chara_id,event_id)
if chara_voice["p1"] :
voice chara_voice["p1"]
$ my_text = my_script[count]["text"] + str(emo_atl_creator(my_script[count]["p1_chara_emoticon_id"]))
if my_script[count]["p1_chara_type"]=="5":
$ face = my_script[count]["p1_chara_emotion"]
show chara_emotion at action_atl_creator(my_script[count]["p1_chara_motion_type"],my_script[count]["p1_chara_motion_times"])
else:
hide chara_emotion
if my_script[count]["p1_chara_emoticon_id"]!="0":
$ emo = my_script[count]["p1_chara_emoticon_id"]
show emotion
else:
hide emotion
gaap '[my_text]'
$ count += 1
目前這段代碼是可以正常使用的...at action_atl_creator(trans, times) 的方式..但是這個times參數不知道有沒辦法直接傳給transform repeat使用
還有就是想請問python中要返回ATL對象應該怎麼寫...有大概看了一下源碼.但對我來說果然還是太吃力了 (
類似這樣
[RenPy] 纯文本查看 复制代码 transform emo_3056:
xpos 1280
ypos 450
transform emo_3060:
xpos 1320
ypos 600
transform emo_3061:
xpos 1400
ypos 550
[RenPy] 纯文本查看 复制代码 def emo_atl_creator(id):
return type(trans_default)
# id = 3056 or 3060 or 3061
return renpy.display.transform("emo_"+str(id))
有參考了一下這兩篇.但問題還沒有解決..如果有文章直接貼給我也好..我是沒搜到...THX
https://lemmasoft.renai.us/forums/viewtopic.php?t=43194
https://www.renpy.org/doc/html/trans_trans_python.html#transforms
|