找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12978|回复: 1

[已解决] 请问如何实现可视移动组件图片移动后交换图片。

[复制链接]
发表于 2019-11-29 07:57:52 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 13390163901 于 2019-11-29 11:30 编辑

比如现在可视移动组件屏幕上有左右两个图片,我用指针拖拽把右侧的图片移动到左边的图片上,让左边的图片变成右边的,然后右边的图片移出,请问我应该怎么做?我看了官方教程,应该是用DragGroup,不过试了许多次都报错了,求大佬帮助!
 楼主| 发表于 2019-11-29 11:56:34 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
default how = " "
default detective = False
default city = " "
default c0_drop_1 = False
default c = True

############### 拖动交互,无触碰交互,则返回原位置 ####################

init  python:
    ## 1号
    def detective_dragged(drags, drop):
        if not drop:
            drags[0].snap(500,20, 0.1)
        if drop:
            store.detective = drags[0].drag_name
            store.city = drop.drag_name
            store.how = store.detective
            store.detective = True
            drags[0].snap(50,50, 0.1)
            store.c = False # 不再允许拖动。
            renpy.restart_interaction() ## 重新开始当前的交互。

###############################################################
screen c0:
    add "bathroom.png" # 背景。
    draggroup:

        drag:

            drag_name "c0"
            child "ivy.png"
            droppable False
            dragged detective_dragged # 有触碰,就执行函数
            if c == True :
                draggable True
            if c == False :
                draggable False
            xpos 500 ypos 20
        if detective == False:
            drag:
                drag_name "1"
                draggable False
                child "alice_headb.png"
                xpos 50 ypos 50
##################################################
label start:
    call screen c0

现在会实现上面的要求了,不过请问诸位大佬有办法让它在拖拽松手的时刻播放sound嘛?
回复 支持 抱歉

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|RenPy中文空间 ( 苏ICP备17067825号|苏公网安备 32092302000068号 )

GMT+8, 2024-4-24 16:38 , Processed in 0.055764 second(s), 12 queries , File On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表