Lua 不能';哥托森';使用Corona SDK
我试了,试了,试了。但却无法实现这一目标 我所有的东西都是主的,里面有一个按钮。然后我想把这件事告诉lua 我的主要职责是:Lua 不能';哥托森';使用Corona SDK,lua,coronasdk,Lua,Coronasdk,我试了,试了,试了。但却无法实现这一目标 我所有的东西都是主的,里面有一个按钮。然后我想把这件事告诉lua 我的主要职责是: local function about(event) storyboard.gotoScene( "about", {"Fade", 500} ) return true end local about = widget.newButton { top = 280, width = 320, he
local function about(event)
storyboard.gotoScene( "about", {"Fade", 500} )
return true
end
local about = widget.newButton
{
top = 280,
width = 320,
height = 66,
defaultFile = "about.png",
overFile = "aboutdown.png",
onRelease = about
}
我对lua的看法是:
local storyboard = require ( "storyboard" )
local scene = storyboard.newScene()
local widget = require ( "widget" )
local background = display.newImage( "logo.png" )
background.x = display.contentCenterX
background.y = display.contentCenterY
请帮忙 如果查看,您将看到创建场景所需的模板代码,请将所有模板代码复制到about.lua并将实际代码包含在createScene函数中,它应该可以工作
第一步:使用模板代码创建一个新的about.lua
第二步:在createScene函数中添加代码,如下所示,background
和widget
是前向声明,因此它们在函数调用之前
local widget = require ( "widget" )
local background
-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view
-----------------------------------------------------------------------------
-- CREATE display objects and add them to 'group' here.
-- Example use-case: Restore 'group' from previously saved state.
-----------------------------------------------------------------------------
background = display.newImage( "logo.png" )
background.x = display.contentCenterX
background.y = display.contentCenterY
end
你有什么错误?没有错误,什么也没有发生。你读过文档了吗?您缺少了此处讨论的一些非常基本的内容,如场景创建/删除事件、向场景添加项目等。您在代码中向场景对象添加项目的位置?在发布之前做一些挖掘。哦,对了,我是新来的,所以这仍然有点混乱。你能给我举个例子吗?我很难掌握场景的内容。哦,对了,那么如何使用模板代码创建about.lua呢?我刚刚复制了main.lua,更改了名称,并深入研究了其中的所有内容?在上查找模板代码,然后将其复制到新的about.lua空白处