为了配合第一个答案,这里有一个例子:
local starTable = {}
local star1 = <display object>
starTable:insert(star1)
local function showStarTable()
starTable.alpha = 1
end
timer.performWithDelay( 500, showStarTable, 1 )
local function hideStarTable()
starTable.alpha = 0
end
timer.performWithDelay( 1000, hideStarTable, 1 )
或者你想坚持一张实际的桌子。并且没有看到实际插入到您的starTable中的内容,您可以尝试:
local starTable = {}
local star = <display object>
starTable[1] = star
star = <display object>
starTable[2] = star
star = <display object>
starTable[3] = star
local function showStarTable()
for i=1, #starTable do
starTable[i].star.alpha = 1
end
end
timer.performWithDelay( 500, showStarTable, 1 )
local function hideStarTable()
for i=1, #starTable do
starTable[i].star.alpha = 0
end
end
timer.performWithDelay( 1000, hideStarTable, 1 )
但是,第一个选项更好,如果它适用于您的程序。