我有以下场景:
我想使用重力移动球,所以我写了以下内容:
function onTilt( event )
deltaDegreesXText.text = "xG: " .. (9.8*event.xGravity)
deltaDegreesYText.text = "yG: " .. (-9.8*event.yGravity)
if(ball.isAwake==true)then
fallAsleepText.text = "True "
elseif(ball.isAwake==false)then
fallAsleepText.text = "False "
end
physics.setGravity( ( 9.8 * event.xGravity ), ( -9.8 * event.yGravity ) )
end
问题是几秒钟后球对象进入睡眠状态并且不再移动。在代码的乞求中,我有以下内容:
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
system.setIdleTimer( false )
local physics = require "physics"
local physicsData = (require "myphysics").physicsData(1.0)
physics.start( true)
知道出了什么问题吗?为什么physics.start(noSleep)不起作用或者我怎样才能阻止球掉入睡眠?