找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11879|回复: 1

[已解决] 关于拖放系统的求助

[复制链接]
发表于 2018-5-13 22:12:11 | 显示全部楼层 |阅读模式

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

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

×
想做一个拖放系统,把打乱排列的几样证物拖进对应的槽内才能推进剧情那种……有没有大神能指点一下看哪篇文章或者贴一点范例……我站内搜索没找到……
发表于 2018-5-14 17:32:49 | 显示全部楼层
本帖最后由 BuErShen 于 2019-4-17 13:04 编辑

我来回答吧,
“拖放(Drag and Drop)”文档不知您看了没有?
https://doc.renpy.cn/zh-CN/drag_drop.html#drag-drop-examples
文档中有两个示例,其中第二个好像符合您的需求:
示例脚本如下:
[RenPy] 纯文本查看 复制代码
init python:
 
    def detective_dragged(drags, drop):
 
        if not drop:
            return
 
        store.detective = drags[0].drag_name
        store.city = drop.drag_name
 
        return True
screen send_detective_screen:
 
    # 地图作为背景。
    add "europe.jpg"
 
    # 一个DragGroup(拖放组)确保侦探和城市
    # 可以互相拖放。
    draggroup:
 
        # 我们的侦探。
        drag:
            drag_name "Ivy"
            child "ivy.png"
            droppable False
            dragged detective_dragged
            xpos 100 ypos 100
        drag:
            drag_name "Zack"
            child "zack.png"
            droppable False
            dragged detective_dragged
            xpos 150 ypos 100
 
        # 他们可以去的城市。
        drag:
            drag_name "London"
            child "london.png"
            draggable False
            xpos 450 ypos 140
        drag:
            drag_name "Paris"
            draggable False
            child "paris.png"
            xpos 500 ypos 280
label send_detective:
    "我们需要调查,我们应该派谁去,他们应该去哪里?"
 
    call screen send_detective_screen
 
    "好的,我们会派 [detective] 到 [city]."

回复 支持 1 抱歉 0

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-24 17:09 , Processed in 0.070838 second(s), 13 queries , File On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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