I have a function that allows the user to draw a line on the screen. With build 1202 it will crash the game upon drawing a line. Terminal says:
Terminal: line 9: 2966 Segmentation fault: 11 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout
So I don’t what changes need to be made. The function is a line drawing i got from code-exchange
<lua>
function drawLine(e)
if e.phase == “began” then
prev_x = e.x
prev_y = e.y
elseif e.phase == “moved” then
lines[line_number] = display.newLine(prev_x, prev_y, e.x, e.y)
lines[line_number]:setColor(0,191,255)
lines[line_number].width = line_width
group:insert(lines[line_number])
dist_x = e.x - prev_x
dist_y = e.y - prev_y
– Add a physics body that’s a flat polygon that follows each segment of the line
physics.addBody(lines[line_number], “static”, { density = 1, friction = 1, bounce = .1, shape = {0, 0, dist_x, dist_y, 0, 0} } )
prev_x = e.x
prev_y = e.y
line_number = line_number + 1
elseif e.phase == “ended” then
end
end
Runtime:addEventListener(“touch”, drawLine)