Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Navigation 日冕中的Lua导航_Navigation_Lua_Coronasdk - Fatal编程技术网

Navigation 日冕中的Lua导航

Navigation 日冕中的Lua导航,navigation,lua,coronasdk,Navigation,Lua,Coronasdk,我有一个level1.lua独立的工作程序。但是,当我想使用gotoScene()导航到它时,它不会播放 local storyboard = require "storyboard" local scene = storyboard.newScene("level1") local function level1_pressed() storyboard.gotoScene( "level1", "fade" ,40 ) print("level1 should start"

我有一个level1.lua独立的工作程序。但是,当我想使用
gotoScene()
导航到它时,它不会播放

local storyboard = require "storyboard"
local scene = storyboard.newScene("level1")

local function level1_pressed()
    storyboard.gotoScene( "level1", "fade" ,40 )
    print("level1 should start")
    return true
end

local level1 = display.newText( "level1",20 ,20,font, 40 )
level1:setTextColor(math.random( 50, 200 ),math.random( 50, 200 ),math.random( 50, 200 ))

level1:addEventListener( "touch", level1_pressed )
这是我的主要任务。 “level1应该开始”字符串正确打印在终端上,但它没有开始!
有什么问题吗?

你读了吗?level1.lua应该包含以下内容。另请查看第页的故事板教程。

根据上提供的故事板文档,您的storyboard.gotoScene()语法不正确

    local storyboard = require "storyboard"
    local scene = storyboard.newScene("level1")

    local options = {
        effect = "fade",
        time = 40
    }

    local function level1_pressed()
            storyboard.gotoScene( "level1", options)
            print("level1 should start")
            return true
    end

    local level1 = display.newText( "level1",20 ,20,font, 40 )
    level1:setTextColor(math.random( 50, 200 ),math.random( 50, 200 ),math.random( 50, 200 ))

    level1:addEventListener( "touch", level1_pressed )