中的I代码
我正在开发一个应用程序来观察你的跑步速度,为此,我需要一个显示你的最高速度的函数但找不到我该怎么做。
local speedText = string.format( '%.3f', event.speed )
speed.y = 250
speed.x = 125
local numValue = tonumber(speedText)*3.6
if numValue ~= nil then
speed.text = math.round( numValue )
end
我已经将我的"speedText"设置为您在上面看到的数字。
Corona SDK/Lua
您需要跟踪每帧中的速度,并做一些简单的事情:
if event.speed > currentMaxSpeed then
currentMaxSpeed = event.speed;
end