: 게임 메인 메뉴로 이동해야 할 때, 내 말은 로딩 화면 를 제거합니다.
local loadingText = display.newText("LOADING ...", 0, 0, native.systemFont, 24)
myText:setTextColor(255, 255, 255)
local function loadAlImages()
--create all your images here.
--remove LOADING text
end
--if you still see black screen at the start try to increase delay > 500 ms
timer.performWithDelay(500, loadAlImages, 1)
이제
.isVisible = 거짓와 때를와 스프라이트, 표시하고 다음 화면 자산은 당신이 당신의 이미지를 만들어야합니다로드 얼마나 많은 계산하는 비율이 다른 텍스트를 업데이트 할 경우
모두 생성 된 변경 .isVisible = true. 일부 이미지를 만든 후에 백분율 텍스트를 업데이트하는 코드를 넣을 수 있습니다.
local loadingText = display.newText("LOADING ...", 0, 0, native.systemFont, 24)
myText:setTextColor(255, 255, 255)
local function loadAlImages()
--create some images here.
--update text's percentage to 20%
--create some images here.
--update text's percentage to 50%
--create some sprites here.
--update text's percentage to 90%
--change **.isVisible=true** for all your created files but **.alpha=0**
--update text's percentage to 100%
--remove LOADING text
--transition .alpha of all images to 1
end
timer.performWithDelay(500, loadAlImages, 1)
나는 하나 개 표시 그룹에있는 모든 이미지 파일을 넣을 수 있다고 생각하고이 그룹에 .isVisible = 거짓을 설정합니다. 이렇게하면 코드 줄을 절약 할 수 있습니다. (α)에 대한 동일 = 0
은 여러 가지가 있습니다. 변수를 선언 한 다음 loadAlImages() 함수에서 변수를 만들거나 테이블에 변수를 모두 만들고이 테이블을 사용하여 원하는 이미지를 얻을 수 있습니다. 첫 번째 예 : 테이블에
local image
local function loadAlImages()
--create some images here.
image = display.newImageRect("image.png", 100, 100)
image:setReferencePoint(display.CenterReferencePoint)
image.x = display.contentCenterX
image.y = display.contentCenterY
--create some sprites here.
end
예 :
local imagesTable = { }
local function loadAlImages()
--create some images here.
local image = display.newImageRect("image.png", 100, 100)
image:setReferencePoint(display.CenterReferencePoint)
image.x = display.contentCenterX
image.y = display.contentCenterY
imagesTable.image = image
--create some sprites here.
end
더 많은 정보는 :
http://lua-users.org/wiki/ScopeTutorial
http://www.coronalabs.com/blog/2011/06/21/understanding-lua-tables-in-corona-sdk/
http://lua-users.org/wiki/TablesTutorial
모든 이미지와 스프라이트가 로컬에 있어야합니까? 또는 글로벌? 기능을 추가하려면 "탭"이벤트와 함께 그 중 일부를 사용하고 싶습니다. – user2347313
대단히 감사합니다! 나는 투표했다 – user2347313