I am doing a line drawing game, trying to create lines based on the users touch path. The following code is how i assume it should be handled, however during the line drawing process the line is flashing and flickering instead of staying solid. Is this a bug?
[code]
function moveCharacter(event)
if event.phase == “began” and
event.x < (people.x+200) and event.x > (people.x-200) and
event.y < (people.y+200) and event.y > (people.y-200) then
lines={};
for i, v in ipairs(lineTimers) do
if v then
timer.cancel(v);
end
end
lineTimers={};
totalTime=0;
if lineSegments and lineSegments.parent then
lineSegments.parent:remove(lineSegments);
end
lineSegments=nil;
table.insert(lines, {people.x, people.y});
lineSegments = display.newLine(people.x, people.y, event.x, event.y);
lineSegments:setColor(255, 0, 255);
lineSegments.width=3;
elseif event.phase==“ended” then
local intNum=1;
transition.to(lineSegments, {alpha=0, time=3000});
timer.performWithDelay(3000, function()
lineSegments.parent:remove(lineSegments);
lineSegments=nil;
end);
for i, v in ipairs(lines) do
peopleMain.parent:insert(peopleMain);
local lineTimer = timer.performWithDelay(totalTime, function()
–start path traversal
end);
totalTime = totalTime+100;
table.insert(lineTimers, lineTimer);
intNum=intNum+1;
end
else
table.insert(lines, {event.x, event.y});
lineSegments:append(event.x, event.y);
end
end
Runtime:addEventListener(“touch”, moveCharacter);
[/code] [import]uid: 6317 topic_id: 1287 reply_id: 301287[/import]

