Total Pageviews

Monday, April 21, 2014

physics.pause()

physics.pause()
ប្រើសំរាប់ ឈប់ physics engine
Syntax: physics.pause()
សូមមើលកូដះ
local isPaused = false
function pausePhysics( event )
    if "began" == event.phase then
        if isPaused == false then
            physics.pause()
            isPaused = true
        elseif isPaused == true then
            physics.start()
            isPaused = false
        end
    end
end

Runtime:addEventListener( "touch", pausePhysics )
physics.start()
-- pause physics simulation after 3 seconds
timer.performWithDelay( 3000, function()

    physics.pause()

end, 1 )


No comments:

Post a Comment