How can I remove a few lines.

 How can I remove a few lines.

I wrote a lua code for a simple writing or drawing board, but when I draw a line, it automatically draws another from the point where I start to draw to one of the corners. Works well in the Computer, but when I step into the cell appear thats lines. I’d like to know what the problem might be. Thank you.

line={}; local t=1

function dibujar(e)

    if e.phase==“began”  then                     

        line[t] = display.newLine(e.x,e.y,e.x,e.y)

        line[t].width =6

    end

    if e.phase==“moved”  then

        line[t]:append(e.x,e.y)  

    end

     if e.phase==“ended”  then           t=t+1     end

end

Runtime:addEventListener(“touch”, dibujar)

Is there more code that you haven’t pasted here? I can’t see anything in your code that would be causing this to happen, and usually if there was an error when creating an object I’d expect things to appear in the top left corner, not the top right.

In the Crown Simulator everything works well. Pero when I build on Android and install it on my cell It doesn’t work well. 

Hi.  I think you’re making a few mistakes in your efforts.  Here is an old tool I made for myself some time ago:

https://www.youtube.com/watch?v=C6nm_MLZeTs&feature=youtu.be

I have an old example that I’m releasing here:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/01/whiteBoard.zip

It is a multi-page drawing program that I called “White Board”.  I made it long ago for my work on Corona Geek to let me draw on the screen while talking and to maintain multiple pages.

It has a few nice (if messy) features and I think if you examine it closely you’ll see some variance between the way I’ve handled this versus your approach.  For example:

  • When drawing, I accumulate points at a minimum distance from each other and draw circles.
  • When finger is released I remove the circles and draw a line.
  • This allows me to avoid having too many points in the line.
  • Tip: This approach would allow me to feed the data directly into a smoothing algorithm too, but I don’t think I did that.  (or did I?  need to double check…).

Cheers,

Ed

PS - uses SSK.  Sorry if that’s confusing, but I simply don’t do long hand Corona any more and its fully documented.

Is there more code that you haven’t pasted here? I can’t see anything in your code that would be causing this to happen, and usually if there was an error when creating an object I’d expect things to appear in the top left corner, not the top right.

In the Crown Simulator everything works well. Pero when I build on Android and install it on my cell It doesn’t work well. 

Hi.  I think you’re making a few mistakes in your efforts.  Here is an old tool I made for myself some time ago:

https://www.youtube.com/watch?v=C6nm_MLZeTs&feature=youtu.be

I have an old example that I’m releasing here:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/01/whiteBoard.zip

It is a multi-page drawing program that I called “White Board”.  I made it long ago for my work on Corona Geek to let me draw on the screen while talking and to maintain multiple pages.

It has a few nice (if messy) features and I think if you examine it closely you’ll see some variance between the way I’ve handled this versus your approach.  For example:

  • When drawing, I accumulate points at a minimum distance from each other and draw circles.
  • When finger is released I remove the circles and draw a line.
  • This allows me to avoid having too many points in the line.
  • Tip: This approach would allow me to feed the data directly into a smoothing algorithm too, but I don’t think I did that.  (or did I?  need to double check…).

Cheers,

Ed

PS - uses SSK.  Sorry if that’s confusing, but I simply don’t do long hand Corona any more and its fully documented.