2013-12-13 3 views
0

저는 게임을하고 있는데 몇 시간이 지나서 문제가 있습니다. 어떻게 해결 해야할지 모르겠습니다!LUA - 코로나 SDK - 스토리 보드의 가치 없음

bg_menulvl :

는 내가 모든 게임 플레이를 제어하는 ​​내 수준의 게임을 구현하려고 할 때, 나는 오류를 얻을, 새로운 스토리 보드와 함께하고 잘 작동 것 시작에, 언제나처럼 내 게임을 시작하지만. 루아 : 내 논리를 구현하는

function scene:createScene(event) 
local group = self.view 

local background = display.newImageRect("images/backgrounds/bg_menulvl.jpg", display.contentWidth, display.contentHeight) 
background.x, background.y = display.contentCenterX, display.contentCenterY 

btn_back = widget.newButton 
{ 
    defaultFile = "images/boutons/b_back.png", 
    width = 200, height = 200, left = 150, top = 80, 
    onRelease = onbtn_back 
} 

local function onbtn_back() 
local Game 
Game = game.new("images/backgrounds/bg_rio.jpg") 
Game:startGame() 
storyboard.removeScene("bg_menulvl") 
end 

game.lua는

local function onbtn_map() 
storyboard.gotoScene("bg_menulvl", "fade", 500) 
end 

local function onbtn_score() 
storyboard.gotoScene("bg_score", "fade", 500) 
end 

function game.new(levelN) 

function initGame() 
    local background = display.newImageRect(levelN, display.contentWidth, display.contentHeight) 
    background.x, background.y = display.contentCenterX, display.contentCenterY 

    btn_pause = widget.newButton 
    { 
     defaultFile = "images/boutons/b_pause.png", 
     width = 150, height = 150, left = 1700, top = 40, 
     onRelease = onbtn_map 
    } 
end 

그래서, 이것을 이해하기 위해, 나는 bg_menulvl.lua에서 게임을 시작하고 내가 클릭하면, 나는 새로운 게임을 만들 하지만 내 게임을 시작한 후 onbtn_map을 클릭하면 새로운 스토리 보드를 만들고 게임 인스턴스를 만들었습니다. ...

하지만이 오류는 항상 얻을 수 있습니다. 없음 값 (GoToScene 기능)

누군가가 나를 도울 수 있다면 ... 감사합니다!

답변

0

이 작품을 사용하고 있습니까?

storyboard.loadScene("bg_menulvl", "fade", 500) 

희망 하시겠습니까?

+0

아무 일도 없었습니다. 실수도, 아무것도. 나는 왜 그런지 모르겠다. / –