Hi,
I have not tried this on a device, but I tried to see how Corona handled a number of objects.
local random = math.random
local maxObjects=50000 --- Play with this
local currentObject = 1
local startDeleting = false
local holdObject={} --- Array/Table that holds the objects
local newObject
local tempObject
drawObject = function(event)
local x
local y
if event.phase == "ended" then
x = event.x
y = event.y
newObject = display.newCircle(x,y,10)
newObject:setFillColor(random(1,255),random(1,255),random(1,255))
if startDeleting then
tempObject = holdObject[currentObject]
tempObject:removeSelf()
end
holdObject[currentObject] = newObject
currentObject = currentObject+1
if currentObject\>maxObjects then
startDeleting = true
currentObjects=1
end
end
end
--Create the maxObject number of circles on screen, optional to test
local i=1
while i \<= maxObjects do
local x = random(0,display.contentWidth)
local y = random(0,display.contentHeight)
newObject = display.newCircle(x,y,10)
newObject:setFillColor(random(1,255),random(1,255),random(1,255))
holdObject[i] = newObject
i = i+1
end
startDeleting = true
Runtime:addEventListener("touch", drawObject)
The other thing was, if your circles are the same size, have you tried making it a sprite? I think sprites are pretty optimised on Corona.
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 3458 reply_id: 10408[/import]