How can I clear the entire display? I have tried doing display.remove(obj)
and obj:removeSelf()
on everything that was drawn, but it seems to miss a few things and I am unsure why.
A very basic version of this part would look like this:
Runtime:addEventListener("accelerometer", onShake)
Runtime:addEventListener( "touch", draw );
--Initialize arrScreen and other variables
function onShake (event)
if event.isShake then
--for loops
display.remove(arrScreen[i][j])
--arrScreen[i][j]:removeSelf()
--end for loops
end
end
function draw(event)
if event.phase == "began" then
arrScreen[event.x][event.y]=display.newRect(event.x,event.y,size,size)
lastPoint.x=event.x
lastPoint.y=event.y
elseif event.phase ~= "ended" then
arrScreen[event.x][event.y]=display.newLine(event.x,event.y,lastPoint.x,lastPoint.y)
lastPoint.x=event.x
lastPoint.y=event.y
end
end