Long time since my last question

Well, here is a bummer.
I'm coding a simple drawing app for children just for fun, well for my little nephew mainly.
I've been able to draw with different colors and different pen sizes.
Here is the very basic drawing code:
Code: Select all
on touchMove pId, pX, pY
if (pId is among the lines of sId) then
put the points of graphic ("theLine" & pId) into tPoints
put return & pX & comma & pY after tPoints
set the points of graphic ("theLine" & pId) to tPoints
end if
end touchMove
The below code doesn't work consistently, it's too slow to be processed I think.
Code: Select all
on touchMove pId, pX, pY
if sEraseMode then
put (pX & comma & pY) into tPoint
repeat with x=1 to (the number of graphics of me)
put the points of graphic x into tPoints
if tPoint is among the lines of tPoints then
replace tPoint with empty in tPoints
set the points of graphic x to tPoints
end if
end repeat
end if
end touchMove
Any insights how to accomplish this deleting task?
Maybe, the whole creating a graphic for drawing is wrong way to choose?
Thanks for any ideas...
Best,
~ Ender Nafi