here is the GUI script:
settings = require "main.settings"
function init(self)
self.buttons = { "btn_start","btn_stop" }
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
if action.pressed then
----------------------
if action_id == hash("click") or action_id == hash("touch") then
local x = action.x
local y = action.y
for i, n in ipairs(self.buttons) do
if gui.pick_node(gui.get_node(n), x, y) then
------------------
if n == self.buttons[1] then
settings.gameState = 100
print("start from main_menu")
elseif n == self.buttons[2] then
print("stop from main_menu")
end
------------------
end
end
end
----------------------
end
end
on windows it works ok, but on android every touch on the button “btn_start” executes this block twice:
------------------
if n == self.buttons[1] then
settings.gameState = 100
print("start from main_menu")
end
------------------
What i’m doing wrong?