Hello,
Does anyone know how i can add a physic body to this line? I want to draw the line and correspond to object hitting it, making it “static”. Any help? Right now it is just a normal line that is drawn and is erased after releasing every other one. All i need is to add a physic body to it. I want to make the whole line static. Can someone please help, i really need this. Thank you SO MUCH .Help is very much APPRECIATED.
[code]
local lines = {}
local myLines = {}
local prevX,prevY
local function removeLine(myLine)
for i=1,#myLine do
myLine[i]:removeSelf()
myLine[i] = nil
end
end
local i = 1
local function drawLine(e)
if “began” == e.phase then
myLines[i] = {}
prevX = e.x
prevY = e.y
elseif “moved” == e.phase then
if prevX then
myLines[i][#myLines[i] + 1] = display.newLine(prevX,prevY,e.x,e.y)
myLines[i][#myLines[i]].width = 3
end
prevX = e.x
prevY = e.y
elseif “ended” == e.phase then
prevX = nil
prevY = nil
i = i + 1
–you can get to individual lines using this.
removeLine(myLines[#myLines-1])
end
end
Runtime:addEventListener(“touch”,drawLine) [import]uid: 66985 topic_id: 14381 reply_id: 314381[/import]

