OK, I have currently just updated the function to allow shapes to be specified, the other options would be trickier. For instance to create a body from points you would also need to specify which layer the point objects are on.
[code]
— Builds the physical representation of the Tile.
function Tile:build()
if(self.HasBody and self.sprite) then
local body = self.sprite
if(self.shape) then
if type(self.shape) == “string” then
local splitShape = splitString(self.shape, “,”)
if #splitShape > 1 then
local shape = {}
for i = 1, #splitShape, 1 do
shape[#shape + 1] = tonumber(splitShape[i])
end
self.shape = shape
end
end
end
– Now that tiles can be set at runtime it is important to make sure physics is loaded as it may not have been at load time
if not physics then
require(“physics”)
physics.start()
end
self.isSensor = stringToBool(self.isSensor)
addCollisionFilterToBody( self )
physics.addBody( body, self )
applyPhysicalParametersToBody(body, self)
addPropertiesToBody(body, self)
end
end
[/code] [import]uid: 5833 topic_id: 6863 reply_id: 23953[/import]