[RenPy] 纯文本查看 复制代码
#——————————————————————————————————————————————————————————————
# 这部分可以先跳过
layeredimage sb:
always:
"sb_skin_default"
group skin:
attribute skin1 default:
"sb_skin_1"
attribute skin2:
"sb_skin_2"
group under:
attribute under1 default:
"sb_under_1"
attribute under2:
"sb_under_2"
attribute under3:
"sb_under_3"
group top:
attribute top1:
"sb_top_1"
attribute top2 default:
"sb_top_2"
attribute top3:
"sb_top_3"
group hair:
attribute hair1 default:
"sb_hair_1"
attribute hair2:
"sb_hair_2"
attribute hair3:
"sb_hair_3"
group totem:
attribute totem1 default:
"sb_totem_1"
attribute totem2:
"sb_totem_2"
attribute totem3:
"sb_totem_3"
group face:
attribute face1 default:
"sb_face_1"
attribute face2:
"sb_face_2"
attribute face3:
"sb_face_3"
image avator_user = "sb skin%d hair%d top%d face%d under%d totem%d"%(skinnum,hairnum,topnum,facenum,undernum,totemnum)
image side_avator = LayeredImageProxy("avator_user", Transform(crop=(0, 0, 440, 440), xoffset=-550))
# 以上是运用层叠图形做的部位拼装,但遇到一些问题最终未采用
#————————————————————————————————————————————————————————————————————————
init python:
facechoice = False # 默认样式选择按钮不显示
hairchoice = False
topchoice = False
undernum,topnum,skinnum,facenum,totemnum,hairnum = 1,1,1,1,1,1
def draw_avator(st, at): # 纸娃娃实时预览组件
return LiveComposite(
(460, 1020),
(0, 0), "sb_skin_%d"%skinnum, #肤色
(0, 0), "sb_face_%d"%facenum, #五官
(0, 0), "sb_totem_%d"%totemnum, #面纹
(0, 0), "sb_hair_%d"%hairnum, #发型
(0, 0), "sb_under_%d"%undernum, #下装
(0, 0), "sb_top_%d"%topnum, #上装
),.1 # 想问一下这个“.1”在这里是什么用法和意思?
transform button_b:
# 部位选择按钮焦点时放大的动态
anchor (0.5 , 0.5)
on idle:
linear 0.1 zoom 1
on hover:
linear 0.1 zoom 1.2
transform slidd:
# 用作mousearea触发按钮,从屏幕外滑入的动态
pos(-135,0)
on idle:
linear 0.15 xpos 0
transform choiceframe_left:
#左上角/右下角选择框的旋转和伸展动态
anchor (0.5,0.5)
rotate 30
xzoom 0.0 yzoom 1.0
linear 0.15 xzoom 1.0 yzoom 1.0
transform choiceframe_right:
#右上角/左下角选择框的旋转和伸展动态
anchor (0.5,0.5)
rotate -30
xzoom 0.0 yzoom 1.0
linear 0.15 xzoom 1.0 yzoom 1.0
transform choiceframe_center:
#中间选择框的伸展动态
anchor (0.5,0.5)
xzoom 0.0 yzoom 1.0
linear 0.15 xzoom 1.0 yzoom 1.0
transform choicebutton:
#样式选择按钮的渐入动态
alpha 0.00
0.3
anchor (0.5,0.5)
linear 0.3 alpha 1.0
transform bgchange:
#图片渐入动态
alpha 0.1
0.05
alpha 0.2
0.05
alpha 0.3
0.05
alpha 0.4
0.05
alpha 0.5
0.05
alpha 0.6
0.05
alpha 0.7
0.05
alpha 0.8
0.05
alpha 0.9
0.05
alpha 1.0
init:
#这里是照抄的,想问一下这个“init:”的用法是什么,和“init Python”有什么区别,如果这里不用“init”会怎样?
image avator = DynamicDisplayable(draw_avator)
$ a = Character('avator', color="#a50303") # 这里 a 前面为什么需要加一个变量符号呢?
screen avatorchange:
#描绘换装页面
add "avatorbg" at bgchange #背景图
add "avator" xpos 680 ypos 56 #预览纸娃娃
textbutton "JUMP" action Jump(label="showtest") xpos 1800 ypos 1020 #跳转到后续剧情
imagebutton:
# 五官按钮
pos (560 , 380)
at button_b
action SetVariable("facechoice",True)
idle "facebutton_1"
hover "facebutton_2"
selected_idle "facebutton_2"
imagebutton:
# 发型按钮
pos (490 , 595)
at button_b
action SetVariable("hairchoice",True)
idle "hairbutton_1"
hover "hairbutton_2"
selected_idle "hairbutton_2"
imagebutton:
# 上装按钮
pos (1408 , 595)
at button_b
action SetVariable("topchoice",True)
idle "topbutton_1"
hover "topbutton_2"
selected_idle "topbutton_2"
screen choiceframe2:
zorder 1
if facechoice:
# 描绘五官样式选择按钮
add "facechoiceframe" at choiceframe_left xpos 365 ypos 290
textbutton "1" action SetVariable("facenum",1) xpos 297 ypos 247 at choicebutton
textbutton "2" action SetVariable("facenum",2) xpos 364 ypos 282 at choicebutton
textbutton "3" action SetVariable("facenum",3) xpos 429 ypos 320 at choicebutton
if hairchoice:
# 描绘发型样式选择按钮
add "facechoiceframe" at choiceframe_center xpos 268 ypos 595
textbutton "1" action SetVariable("hairnum",1) xpos 197 ypos 594 at choicebutton
textbutton "2" action SetVariable("hairnum",2) xpos 270 ypos 594 at choicebutton
textbutton "3" action SetVariable("hairnum",3) xpos 343 ypos 594 at choicebutton
if topchoice:
# 描绘上装样式选择按钮
add "facechoiceframe" at choiceframe_center xpos 1630 ypos 595
textbutton "1" action SetVariable("topnum",1) xpos 1550 ypos 594 at choicebutton
textbutton "2" action SetVariable("topnum",2) xpos 1623 ypos 594 at choicebutton
textbutton "3" action SetVariable("topnum",3) xpos 1696 ypos 594 at choicebutton
# 一个mousearea呼出菜单的测试
#————————————————————————————————————————————————————————————————————————————————————————
screen button_overlay():
mousearea:
area (0, 0, 400,100)
hovered Show("buttonf")
unhovered Hide("buttonf")
screen buttonf():
hbox:
imagebutton:
at slidd
idle "facebutton_1"
hover "facebutton_1"
action ShowMenu("save")
#————————————————————————————————————————————————————————————————————————————————————————
# 游戏在此开始。
label start:
a "这里是换装测试"
show screen button_overlay
show screen choiceframe2 with dissolve
# 这里发现如果 choiceframe2 在 avatorchange 页面之后呼出会无法显示原因是什么呢?
call screen avatorchange with dissolve
label showtest:
hide screen choiceframe2
hide screen avatorchange
scene bg with dissolve
pause 0.1
show avator with dissolve
a "你的avator定制完毕"
a "测试结束"
return # 此处为游戏结尾。