i proofed everything with print() arguments… it still doesnt work. the error says that the x and y coordinates are nil, but they arent! proofed! (maybe it will help you, the error says that there is something wrong with the translate in the debug draw, it says that the translate arguments are nil → it says body.x & body.y are nil, but yeah… they are not!)
the function:
function createBlock(old_x1,old_y1,old_x2,old_y2)
local n = #blocks + 1
new_x1 = old_x1 + 400
new_y1 = old_y1 + 200
new_x2 = old_x2 + 400
new_y2 = old_y2 + 200
print("old_x1 = "..old_x1)
print("new_x1 = "..new_x1)
print()
print("old_y1 = "..old_y1)
print("new_y1 = "..new_y1)
print()
print("old_x2 = "..old_x2)
print("new_x2 = "..new_x2)
print()
print("old_y2 = "..old_y2)
print("new_y2 = "..new_y2)
print()
blocks[n] = physics.body(POLYGON,
vec2(new_x1,new_y1),
vec2(new_x2,new_y1),
vec2(new_x2,new_y2),
vec2(new_x1,new_y2))
blocks[n].x = new_x1
blocks[n].y = new_y1
PDD:addBody(blocks[n])
end
i called this function like this:
createBlock(0,0,10,100)
your maxiking