Hi, I have a question about touch events. I’ll just post an example of what i’m trying to do, to make it easy to comprehend. I need to launch a “touch” event whenever the player presses the background, even if it presses is 1, 2,3 times or keeps the finger on the screen, i’m having problems trying to make it so if he keeps the finger there, without moving it, the event is still running:
local background = display.newRect(0,0,360,480) local cooldown = false local function CDok() cooldown = false end local function spawn(event) if cooldown = false then cooldown = true timer.performWithDelay(200,CDok,1) arrow = display.newImage("arrow.png") end end background:addEventListener("touch",spawn)
The code includes physics and other stuff, but this is the part im stuck at. Obviously, when i press the background and leave the mouse there, nothing happens.
Anyone know any idea to make it happen?
Thanks in advance.