line drawing game... possible to remove segments?

I’m attempting to do a line drawing game type of app, i think the best way to do this is with the polyline API, however when the character moves along the line path, what’s the best way to make the part of the path thats already been travelled disappear? is there a way to remove specific segments that were added? any other possible ways to do this? thanks! [import]uid: 6317 topic_id: 1278 reply_id: 301278[/import]

Hi jwwtaker,

Have you accomplished the linedrawing so the sprite follows the line ?

I’am looking here for the same thing too.

Pls helpme :slight_smile:

Cheers,
Jespar
[import]uid: 2734 topic_id: 1278 reply_id: 4457[/import]

i did this with something similar to

segments={}  
line=nil;  
if event.phase=="began" then  
 line=display.newLine{startX, startY, event.x, event.y};  
 --other line things, color, width, etc...  
 segments={};  
 table.insert(segments, {event.x, event.y});  
elseif event.phase=="moved" or event.phase=="dragged" then  
 line=display.newLine{startX, startY, event.x, event.y};  
 table.insert(segments, {event.x, event.y});  
 for i,v in ipairs(segments) do  
 --append other line segments  
 end  
 --other line things, color, width, etc...  
elseif event.phase=="ended" then  
 line=display.newLine{startX, startY, event.x, event.y};  
 table.insert(segments, {event.x, event.y});  
 local delay=0  
 for i,v in ipairs(segments) do  
 --append other line segments  
 --difference in this method is that in this particular case i use transitions here, something like  
 transition.to(object, {delay=delay, time=300, x=v.x, y=v.y});  
 delay=delay+50;  
 end  
 --other line things, color, width, etc...  
end  

sorry I know this is very pseudo code but hopefully points you in the right direction. [import]uid: 6317 topic_id: 1278 reply_id: 4466[/import]