I need to know the taps count in a period of time (dt)[SOLVED]

We thought in the right direction, only that not action is an array but action.touch.
Something like this :

function on_input(self, action_id, action)
if ((action_id == hash(“mouse_lc”) and action.pressed == true) or (action_id == hash(“onetouch”) and action.touch[1].pressed == true)) and self.alpha_flag == 1 then
self.alpha_tap_count = self.alpha_tap_count + 1
local speed_percent = self.alpha_tap_count * 100 / self.alpha_count

            --set_speed_bar(self, speed_percent)
            if speed_percent > 100 then
                msg.post("car#script", "broken")
            end
            --print(self.alpha_tap_count)
    end

end

Thank you a lot ^)))

1 Like