您好我试图每隔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 )
我已经尝试了这一点但是没有任何成功,任何帮助都非常感谢。
问候凯文,
答案 0 :(得分: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 )