Thanks for the assistance i understand your logic, but I don’t understand how the function works so I have no idea how to implement it into the “draw a line” function I am using. So basically I need to add your function to this function:
[lua]-- Draw a line
local i = 1
local tempLine
local ractgangle_hit = {}
local prevX , prevY
local function runTouch(event)
if(event.phase==“began”) then
if(tempLine==nil) then
tempLine=display.newLine(event.x, event.y, event.x, event.y)
prevX = event.x
prevY = event.y
end
elseif(event.phase==“moved”) then
tempLine:append(event.x,event.y-2)
tempLine.width=tempLine.width+0.9
ractgangle_hit[i] = display.newLine(prevX, prevY, event.x, event.y)
ractgangle_hit[i].width = 5
– Creates physic joints for line (Turn on draw mode to see the effects)
local Width = ractgangle_hit[i].width * 0.6
local Height = ractgangle_hit[i].height * 0.2
– Physic body for the line shape
local lineShape = {-Width,-Height,Width,-Height,Width,Height,-Width,Height}
physics.addBody(ractgangle_hit[i], “static”, { bounce = -1, density=0.3, friction=0.7, shape = lineShape})
prevX = event.x
prevY = event.y
i = i + 1
elseif(event.phase==“ended”) then
tempLine.parent.remove(tempLine)
tempLine=nil
end
end
Runtime:addEventListener(“touch”, runTouch)[/lua]
Any assistance on how to combine these two functions into 1 working function will be much appreciated! [import]uid: 75779 topic_id: 32281 reply_id: 128953[/import]