I used following code to draw a line
But i want to erase that line if finger touches on same line.. Any Idea?
function drawLine( event )
if(event.phase == "ended") then
line = display.newLine(event.xStart, event.yStart开发者_如何转开发, event.x, event.y)
line:setColor(255,0,0)
line.width = 5
end
end
Runtime:addEventListener("touch", drawLine)
Simple. Make the line a sensor and as soon as the user touches the line, remove it from the group or delete the object.
physics.addBody( line, { isSensor = true } )
someGroup:insert(line)
line.collision = removeLine --some function that removes the line from the group someGroup
line:addEventListener(""touch"", line)
精彩评论