改变坠落物体的速度

时间:2013-07-05 20:55:23

标签: lua corona

我可以改变坠落物体的速度吗?

local randomBackC = function()
    local backC = display.newImage("Cloud"..tostring(math.random(1, 4))..".png")
    backC.x = math.random (30, 450); backC.y = -50
    physics.addBody( backC, { density=2.9, friction=0.5, bounce=0.7, radius=24 } )

    local cleanup
    cleanup = function()
       if backC then
           if backC.y >600 then
               backC:removeSelf()
               backC = nil
           end
       end
    end
    Runtime:addEventListener("enterFrame", cleanup)
end
timer.performWithDelay( 500, randomBackC, 0 )

1 个答案:

答案 0 :(得分:2)

您可以尝试使用object.gravityScale