I am trying to add multiple rectangles in one hit through a loop and here is my code:
for i=1,7,1 do
rec = rectangles.createRoundedRect(left, top, 100, 18, 6)
physics.addBody(rec , "static", { density = 1.0, friction = 0.0, bounce = 0.2 } )
left = left + 50
top = top - 35
end
The rectangles are added successfully however they are not treated as bodies (i.e other bodies do not collide with them)
What's wrong with the code?
I solve the issue
I was using object:translate()
to move objects while I was suppose to use object:setLinearVelocity()