I’ve been playing around with Corna SDK for the last few hours, but ran into a problem.
I can’t figure out how to remove objects from screen.
Here’s how the objects get created
--this gets called every few second function createBlock() --cw is display.ContentWidth, and ch is display.ContentHeight local b = display.newRect(cw, math.random(60 + ch / 6, ch - 60 - ch / 6 ), 40, ch / 3) b.name = 'block' -- Block physics physics.addBody(b, 'kinematic') b.isSensor = true blocks:insert(b) end
I want to remove all the objects before starting a new game, and here’s my attempt
for key, item in pairs (blocks) do item:removeSelf( ) end
I am getting the following error attempt to index local ‘item’ (a userdata value)
What am I missing?