2

我想不出任何在 Corona 中实现它的方法。你有什么想法\建议吗?谢谢!

4

2 回答 2

1
local timeOfPressing = 9999999;
local buttonPressed = false;
local function keyListener( event )
    if event.phase == "began" then
        timeOfPressing = event.time;
        buttonPressed = true;
    elseif event.phase == "ended" and buttonPressed then
        local force = event.time - timeOfPressing;
        if force > maximumForce then force = maximumForce end
        buttonPressed = false;
        myJumpFunction(force);
    end
end
于 2012-09-03T12:12:03.930 回答
0

在 event.phase==began 中定义并增加你的力量。

于 2012-09-03T08:55:40.077 回答