0

嗨,我正在尝试每 60 秒将“setLinearVelocity”的值增加 10。

badclouts:setLinearVelocity(0, math.random(100, 150)) -- Drop down

local function setLinearVelocityTimer()
   LinearVelocityTimer= timer.performWithDelay( badclouts, setLinearVelocity, 0 )
   LinearVelocityTimer= setLinearVelocity +10
   --print("time1 " .. setLinearVelocity)
end

countdownTimer()
local mainTimer = timer.performWithDelay( 6000, setLinearVelocityTimer, 10 )

我已经尝试过了,但没有成功,非常感谢任何帮助。

问候凯文,

4

1 回答 1

1

我认为您正在尝试这样做:

badclouts:setLinearVelocity(0, math.random(100, 150)) -- Drop down

local function increaseYVelocity()
   local vx, vy = badclouts:getLinearVelocity()
   vy = vy + 10
   badclouts:setLinearVelocity(vx, vy)
   --print("y component of linear velocity: " .. vy)
end

countdownTimer()  --I don't know nothing about this function

local mainTimer = timer.performWithDelay( 6000, increaseYVelocity, 10 )
于 2013-05-31T21:01:37.530 回答