2014-03-04 3 views
0

게임 다시 시작 기능이 작동하지 않는 것 같습니다. 그 이유는 모르겠습니다. 풍선, 점수가 재설정되지만 게임이 다시 설정되지 않으면 풍선을 다시 쏠 수 없습니다. 이것은이 시뮬레이터에서 보여줍니다 무엇코로나에서 게임 다시 시작 기능이 잘못되었습니다

function createBalloons(a, b) 
    for i = 1, a do 
    for j = 1, b do 

     local balloon = display.newImage ('balloon_fat_red.png', 270+ (i * 30), 80 + (j * 50)) 
     balloonText = display.newText(hiragana_array[x+1], 300, 125) 
     balloonTextt = display.newText(hiragana_array[x+2], 300, 175) 
     balloonTexttt = display.newText(hiragana_array[x+3], 300, 225) 
     balloonText:setFillColor(1,1, 0) 
     balloonTextt:setFillColor(1,1, 0) 
     balloonTexttt:setFillColor(1,1, 0) 
     balloon.name = 'balloon' 
     physics.addBody(balloon) 
     balloon.bodyType = 'static' 
     table.insert(balloons, balloon) 
     end 
    end 
    target.text = #balloons 
end 
    function restartLvl() 
     for i = 1, #balloons do 
     display.remove(balloons[i]) 
     print ("restart level") 
     end 

     score.text = '0' 
     ballRemain.text = '3' 
     balloons = {} 
     createBalloons(1, 3) 
     askUser.isVisible = false 
     yesBtn.isVisible = false 
     noBtn.isVisible = false 
     print("time from start: ", (system.getTimer()-gameTime)) 
     print('send mail') 
     sendMail() 

    end 

합니다 (askUser, yesBtn 및 noBtn 플러스 중 하나를 보이지 가지 않습니다). enter image description here

+0

createBalloons()를 표시 할 수 있습니까? 또한, 당신은 stdout의 마지막 라인 이후에 응답하지 않는다는 것을 의미하지만, 그때까지는 3 번째 재시작 레벨이 출력 된 후에 괜찮습니까? – Schollii

+0

askUser, uesBtn 및 noBtn.isVisible이 어떤 이유로 작동하지 않습니다. – user3305142

+0

게임 종료시 물리를 일시 중지하고 ontouch-handler를 제거하고 restartLvl에서 물리를 시작하지 않았습니까? – Alex

답변

0

그 코드에는 아무런 문제가 나타나지 않습니다. 문제는 다른 곳에서 발생합니다. 좀 더 파헤쳐 야 할 것입니다. 아마도 더 많은 인쇄 진술을 넣을 것입니다. 예를 들어, isVisible이 enterFrame 핸들러처럼 restartLvl 다음의 다른 함수에 의해 true로 재설정 될 수 있습니다.

관련 문제