是否可以让用户在实时代码中绘制图形?

Is it possible to have a user draw a graphic in livecode?

对于我正在开发的游戏,用户必须画一条线,并且对象将沿着线移动。对我来说,用户的行是一个图形然后做这样的事情是合乎逻辑的(用户的行被称为"userLine")

move the image "xyz" to the points of graphic "userLine"

是否可以让用户绘制图形?

查看 choose 命令。这应该可以帮助您入门。

开始画线: (例如,这可以在按钮脚本中。但是您想要触发用户绘图。)

if there is a graphic "userLine" then
    delete graphic "userLine"
end if
set the style of the templateGraphic to "line"
set the selectionHandleColor to the effective backgroundcolor of this card
choose graphic tool

然后在卡片脚本中添加以下处理程序:

on newGraphic
   choose browse tool
   set the selectionHandleColor to black
   set the name of graphic (the number of graphics) to "userLine"
   move btn "radio" to the points of grc "userLine" in 2 seconds
end newGraphic

这个的一些变体应该可以工作。