0
我已经做了一个重新启动按钮,但我不知道如何将重新启动功能附加到按钮。如果任何人都可以提供帮助,那会很棒。在Corona SDK中,如何在游戏结束时添加重启功能?
我已经做了一个重新启动按钮,但我不知道如何将重新启动功能附加到按钮。如果任何人都可以提供帮助,那会很棒。在Corona SDK中,如何在游戏结束时添加重启功能?
local widget = require("widget")
local function Restart(event)
if "began" == event.phase then
--code here when touch begin
elseif "moved" == event.phase then
--code here when move
elseif "ended" == event.phase or "cancelled" == event.phase then
--code here when touch end
end
end
-- Create the widget
local button1 = widget.newButton{
left = 100,
top = 200,
id = "button1",
label = "Label",
onEvent = Restart
}
http://docs.coronalabs.com/api/library/widget/newButton.html 你可以看看它。
顺便说一句,重新启动您的游戏不要忘了初始化变量&时显示。*(如display.newGroup()/ display.newImage()等)