ok so im having trouble manipulating objects created randomly, for example the code below creates random boxes, well how do i maipulate one box without touching affecting the others? can this be done? what if i wanted to manipulate all of them? Where is each box stored since i only see one variable, are they all inside the local crate variable?
thanks
local newCrate = function()
rand = math.random( 50 )
local crate
if (rand < 51) then
crate = display.newImage(“crate.png”);
crate.x = 50 + math.random( 160 )
crate.y = -100
physics.addBody( crate, dynamic,{ density=0.001, friction=1, bounce=.05} )
–crate.angularVelocity=math.random(800-400)
–crate.isSleepingAllowed=false
end
crate:addEventListener(“touch”,removeBody)
end
local dropCrates = timer.performWithDelay( 1000, newCrate, 10 )
