如何在Scratch中执行过程中拖动子画面?
发布于 2014-11-20 23:05:58
这在Scratch Wiki上有介绍。
boisvert's answer在技术上是正确的,然而,他的脚本总是将精灵从它的中心拖走。使用稍微高级一点的脚本将从它被拿起的地方拖动,更像是挂锁:
when green flag clicked
forever
if <<mouse down?> and <touching [mouse-pointer v]?>>
repeat until <not <mouse down?>>
set [offset x v] to ((x position) - (mouse x))
set [offset y v] to ((y position) - (mouse y))
go to x: ((mouse x) + (offset x)) y: ((mouse y) + (offset y))
end
else
wait until <not <mouse down?>>
end(上面的维基链接有this is visual block格式。)
发布于 2012-07-12 07:08:11
单击子画面名称旁边的挂锁。它将看起来是打开的;然后精灵在可执行版本中变为可拖动。
或者,您可以使用脚本对其拖动行为进行编程:
if <mouse down>
set x to (mouse x)
set y to (mouse y)它可以变得更聪明,在偏移位置跟随鼠标,延迟,在放下时捕捉到一个位置,当鼠标经过它时突出显示一些东西……如果你使用脚本,你的选择是无限的。
发布于 2017-01-05 12:07:12
要获得快速而简单的路径,您只需单击子画面的info按钮:Click here for image 1。
在此之后,您应该找到写着:can drag in player的框,然后单击它:Click here for image 2。
这实际上就是它。现在,每当有人玩你的游戏时,他们都可以拖动精灵。你只需要让他们知道这是可能的,因为大多数项目都不允许。
https://stackoverflow.com/questions/2356027
复制相似问题