Line Drawing

Hi Everyone,

Does anyone have some good line drawing code that I can literally drag and drop into my app? I’ve seen a few examples but none seem to be complete or tested and subsequently don’t work.

I’m simply trying to draw a line with my finger. To take it a step further I’d like to convert it afterwards into a static physics object.

Any help would be greatly appreciated.

Thanks! [import]uid: 13974 topic_id: 5999 reply_id: 305999[/import]

Yup I had the same exact and I got the code for it which is:

local function touched( event )  
   
 if event.phase == "moved" then   
  
 local dot = display.newCircle( event.x, event.y, 7, 7 )  
   
 end  
  
end  
   
Runtime:addEventListener("touch", touched)  

its not the best but still works if u draw slowly, but now I know I need to know how to make the line physical!!

So I hope this works for you!!

-auksfrailco5 [import]uid: 44060 topic_id: 5999 reply_id: 27886[/import]

Like this you mean?

Don’t know if it’s the best way to go about drawing a line but …

[code]
local function touched( event )

if event.phase == “moved” then

local dot = display.newCircle( event.x, event.y, 7, 7 )
physics.addBody(dot, “kinematic”, {friction = 1.5, bounce = 0.4})
end

end

Runtime:addEventListener(“touch”, touched)
[/code] [import]uid: 6981 topic_id: 5999 reply_id: 28036[/import]