lua - Corona SDK - Removing drawn line group and then drawing again -


I am trying to delete any line that I have drawn with a widget button and then draw the player again Allow to I have tried to remove the group many times ... and it works ... but then when I get attracted again it crashes! Any help with this scenario?

  display.setStatusBar (display.HiddenStatusBar) requires local physics = "physics" physics. Local (Local) widget = Required ("widget") Local line = {} Local line group = display.newGroup () Local prevx, prevailing local heading = false local i = 0 local kitten = display. NEERact (10, 10, 25, 25) Physics Adbodi (kitten character, "dynamic", {density = 1, local function distance = (x1, y1, x2, y2) local dist_x = x2 - x1 local dist_y = y2 - y1 local distance = math.sqrt = ( dist_x * dist_x) + (dist_y * dist_y) friction = 0.5, bounces = 1.6})) The return distance between the end of the local function drawline (e) (e.phase == "start") then prevx = pre prevy = ey IfDrawing = true i = i + 1 elseif (e.phase == "moved") then local if (lines [i]) then line group: Remove (i) closing lines [i] = display.newline (prevx, prevY, East, IE) lines [I]: Set collars (255, 255, 0) Lines [I] Wide = 5 local dist_x = pre-preceding local dist_y = ey-prevy physics addboard (line [i], "static", {density = 1, friction = 0.5, bounce = 1, size = {0, 0, dist_x, dist_y, 0,}} group: insert (lines [i]) End (A.face == "termination") is = interval = wrong end end runtime: addEventListener ("touch", drawline) local function handlenton (event) if print ("expired" == event.phase) then "Button was pressed and released") End end - Local button 1 widget to widget. Create nube {left = 100, top = 200, id = "button1", label = "Remove your code from below Has been changed and it works. "OK, but not right, you have to follow your code so that he can see what he does. However it is strange that Corona crashes when searching for his object. Local physics = "physical science" physics is required.  
  display.setStatusBar (local.php) local physics = "(widget") local line = {} local Line group = display.newGroup () local prevx, prevalent Local Hydrauling = false i = 0 local kitten crate = display.newRect (10,10,25,25) physics. AddBody (kitten character, "dynamic" local speed distance (x1, y1, x2, y2) local dist_x = x2 - x1 local dist_y = y2 - y1 local distancebb = = math.sqrt ((dist_x * dist_x), {density = 1, friction = 0.5, bounce = 1.6}) + (dist_y * dist_y)) Distance between return (if e.phase == "start") between the local function drawline (E) then prevx = ex prevy = ey isDrawing = True i = i + 1 lineGroup.isVisible = true elseif (E. Fees == "Transferred") then Local Distance = DistanceButin (Prevalent, Prevalent, East, IE) If (Headraising and Distance <100) then ( Lines [ii]) then row Group: Remove (i) End line [I] = display.newline (prevx, prevy, ex, ey lines [i]: set collar (255, 255, 0) lines [i] .with = 5 local dist_x = ex - prevx local dist_y = ey - prev physical physics. addboard (line [i], "static", {density = 1, friction = 0.5, bounce = 1, shape = {0, 0, dist_x, dist_y, 0,}} } Line group: insert (lines [i]) termination elseif (e.phase == "end") then heading = incorrect end and runtime: addEventListener ("touch", drawline) local function handlunton (event) if ("end "== event.phase) then print (" Butt Was not pressed and released ") i = 0 lineGroup.isVisible = End of false end - Widgets Local Button 1 = Widget Create Newbutan {Left = 100, Top = 200, ID = "Button 1", label = "to delete", onEvent = handleButtonEvent}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -