0
例如,我有一條線,我可以用手指畫,我有一個矩形。我想讓我的線在與矩形碰撞時結束繪製。我該怎麼做? 對於離我行的功能:畫線和對象的碰撞(電暈SDK)
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
我想我能做到這一點與碰撞史密斯這樣
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);
,但它不工作...任何想法?
http://stackoverflow.com/questions/11915215/collision-of-a-line-and-object-corona-sdk - 在這裏,謝謝你!最糟糕的是感覺他們甚至不想碰撞 – barmyman 2012-08-11 13:46:20