1
我如何測量產卵物體之間的距離? 即時通訊使用timer.performWithDelay時間對象,但如果你重新啓動遊戲幾次它混亂了。所以我怎麼能說如果對象之間有200px產生一個新的。測量產卵物體之間的距離
如果我嘗試刪除對象「onComplete」它刪除新對象是否有一個簡單的修復?
holl:removeSelf()
holl = nil
產卵代碼:
function hollspawn()
screenGroup = self.view
holl = display.newRect(0, 0, math.random(10, 500), 53)
holl.y = display.contentHeight - holl.contentHeight/2
holl.x =display.contentWidth + holl.contentWidth/2
holl:setFillColor(1, 0, 0)
holl.name = "hollgameover"
physics.addBody(holl, "static", {density=.1, bounce=0.5, friction=.2,filter=playerCollisionFilter })
screenGroup:insert(holl)
trans55 = transition.to(holl,{time=2000, x=display.contentWidth - display.contentWidth - holl.contentWidth/2 - 20, onComplete=pluspoint, transition=easing.OutExpo }) --onComplete=jetReady
end
timereholl = timer.performWithDelay( 1500 , hollspawn, 0)
這取決於您如何訪問對象,您的帖子沒有足夠的信息。還有它不清楚你正在做什麼:你試圖讓hollspawn產生一個對象,只有當其他兩個特定對象的距離超過200像素,或者*你的所有對象中的任意兩個對象比這個更遠? – Schollii