Hi @lab1,
Are these building separate display objects (separate images), or are the just part of the overall map image? If they’re separate objects, it’s probably easier to just apply a physics body to each one, instead of mapping out a multi-element body for the overall map.
If you want to do the second option (all one image), there’s not really any “easier” way, except that you could declare the basic shape as a table:
[lua]
local buildingShape = { 0,-12,20,0,0,12,-20,0 }
[/lua]
Then, for a building, determine its relative offset on the overall map (say -20,-100 from center). Set up an initial table with those offsets, then add the basic shape’s coordinate to that:
[lua]
local thisBuildingShape = { -20,-100,-20,-100,-20,-100,-20,-100 }
for i=1,#thisBuildingShape do
thisBuildingShape[i] = thisBuildingShape[i] + buildingShape[i]
end
[/lua]
After that, you should be able to use “thisBuildingShape” as the shape declaration for the physics body of that building.
Hope this helps,
Brent