user1597438
user1597438

Reputation: 2221

Drawing and appending lines in a single touch Corona SDK

Currently, I am trying to create a game with a similar logic with the famous One Touch Drawing. I already know how to draw lines after research.

Anyway, if for example, I have 4 points in my scene forming a square and I start drawing a line on one of these 4 points, how can I immediately append the line without lifting my finger to end the touch? Right now, this is the current logic of what I've done so far:

function drawLine(event,self)
  if event.phase == "began" then
     --do something here
  elseif event.phase == "moved" then
     local line = display.newLine(x1,y1,x2,y2)
     if myflag == true then
          line:append(.....)
     end
  end
end

I tried making a flag return true if the touch passes a point however this didn't work at all. How can I make it possible to append a line with one touch while drawing it? Thanks in advance.

Upvotes: 0

Views: 958

Answers (1)

DevfaR
DevfaR

Reputation: 1616

i'm creating the same game using corona i'm using image for the pattern and then retracing it using newLine as for the points of each pattern i get the position of my points using the vertices of the pattern. see the image enter image description here

Upvotes: 1

Related Questions