【问题标题】:Get maximum of a speed (number) in Lua [duplicate]在Lua中获得最大速度(数字)[重复]
【发布时间】:2013-02-14 09:34:27
【问题描述】:

我正在开发应用程序来观察你的跑步速度,为此我需要一个显示你的最高速度的功能。但找不到我的方法。

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

中编码

【问题讨论】:

    标签: lua coronasdk


    【解决方案1】:

    你需要跟踪每一帧的速度,然后做一些简单的事情:

    if event.speed > currentMaxSpeed then
        currentMaxSpeed = event.speed;
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-07
      • 2021-01-22
      • 2016-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多