One of my game scene, there are 23 images and size 960x640 for each. All images set visibility to false (object.isVisible = false) but show only first image. When touch on button, next image will be show and current image will be hide. The example code is below:
[lua]local bg = {}
local step = 1
for i =1 , 23 do
bg[i] = display.newImageRect( “bg” … i … “.png”, 480, 320 )
bg[i].isVisible = false
bg[i].x = display.contentWidth / 2
bg[i].y = display.contentHeight / 2
end
local button = display.newRect( 0, 0, 100, 100 )
local function onTouchButton( event )
if event.phase == “began” then
bg[step].isVisible = false
bg[step + 1].isVisible = true
step = step + 1
end
end
button:addEventListener( “touch”, onTouchButton )
bg[1].isVisible = true[/lua]
Until image is between 16-19, my game is crashed.
Please help [import]uid: 107019 topic_id: 21370 reply_id: 321370[/import]
