For example i have a line that i can draw with a finger and i have a rectangle. i want my line to end drawing up when it collisions with the rectangle. How can i do it? For ex my function of a line:
local line = function()
if(e.phase == "began") then
--code for line
elseif(e.phase == "moved") then
--code for line to draw
elseif(e.phase == "ended") then
--code for line to stop draw
end
i guess that i can do that with collision smith like this
local function onCollision( event )
if ( event.phase == "began" ) then
if event.object1.myName == "top" and event.object2.myName == "line" then
line("ended")
end
end
end
Runtime:addEventListener("collision", onCollision);
but it doesn't work...any ideas?