Hi all, if i put display object in an array like this:
allClouds[#allClouds+1]=display.newImageRect("cloud.png",270,140)
group:insert(allClouds[#allClouds])
local cloud=allClouds[#allClouds]
and than i remove the offscreen clouds like this:
local function removeOffscreenItems()
for i = 1, #allClouds do
local cloud = allClouds[i]
if (cloud.x) then
if cloud.x == 1200 or cloud.x ==-150 then
cloud:removeSelf()
print ("nuvola Rimossa!")
print (#allClouds)
end
end
end
end
What’s the situation of my array? I mean, this is really the way we destroy objects? why #allClouds don’t turn to 0? Will i have problem wile creating new clouds?
Thanks… [import]uid: 70929 topic_id: 23639 reply_id: 323639[/import]
[import]uid: 70929 topic_id: 23639 reply_id: 94878[/import]