yes i find that i need to use an object of my own. And i find some build function:
local function addObjectType(params)
params.objects = params.objects or {}
local function buildObject(event)
local obj = params.build(event)
event.object.builtObject = obj
obj.mapObject = event.object
params.objects[obj] = obj
end
for layer, index in map:getLayers(“tile”) do
layer.addObjectListener(“type”, params.objectType, “drawn”, buildObject)
layer.addObjectListener(“type”, params.objectType, “erased”, function(event)
params.objects[event.object.builtObject] = nil
params.remove(event.object.builtObject)
end)
end
objectTypes[#objectTypes + 1] = params
end
and the data for that i have like this:
local objectType = {}
objectType.objectType = “mySpecialObjectType”
objectType.build = function(event)
local object = display.newRect(0, 0, event.object.width, event.object.height)
object.x, object.y = event.object.x, event.object.y
event.object.parent:insert(object)
return object
end
objectType.remove = function(object)
display.remove(object)
end
addObjectType(objectType)
but i dont seems to get it work i understand the basic of how it works but i dont understand how to make it works. And i would be greatfull if you could send me some of the articles