Hi, I’m working at an idle game and I need to know how many times the player tapped (touched the screen) in 2 seconds. For this i tried to use something like
if action.pressed == true and message_id ==hash( tap) then
tap_count = tap count + 1
end
but action.pressed and released is always false… what i’m doing wrong?
Thank You
Ohhh sorry, it was a stupid mistake…is not the code from project, now , this is my code(this code work very well for mouse left click and don’t want to work at wall for my android device and touch. And if i try without action.pressed the touch work all time while the touch is pressed, each frame ):
function on_input(self, action_id, action)
if (action_id == hash(“mouse_lc”) or action_id == hash(“onetouch”)) and action.pressed == true then
self.alpha_tap_count = self.alpha_tap_count + 1
local speed_percent = self.alpha_tap_count * 100 / self.alpha_count
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