开发者

Draw and rub(erase) the line in corona

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜