嗨,我有这个从天上掉下云的小生成功能。
local randomBad1 = function()
local badC1 = display.newImage("BCloud1.png")
badC1.x = math.random (0, 450); badC1.y = -50
physics.addBody( badC1, { density=.1, bounce=0.1, friction=.2, radius=45, filter=badc1CollisionFilter } )
badC1.name = "BCloud1"
badC1.isSensor = true
badC1.rotation = math.random(-20,20) -- Rotate the object
badC1.gravityScale = 0.40
local cleanup
cleanup = function()
if badC1 then
if badC1.y >600 then
badC1:removeSelf()
badC1 = nil
end
end
end
Runtime:addEventListener("enterFrame", cleanup)
end
randomBadC1 = timer.performWithDelay( 3000, randomBad1, 0 )
所以我想知道是否有更好的方法来改变下降速度而不是'gravityScale'?
凯文-