Is there a way to temporarily disable touch? I want to be able to touch the screen and have something happen and then not have anything happen when the screen is touched for the next couple seconds. Thanks in advance for the help.
@bfisher Not sure what you want to do, but here’s an example that prevents a touch for 5 seconds.
function setup()
count=0
et=-10
end
function draw()
background(40, 40, 50)
fill(255)
text("tap screen to increment the count",WIDTH/2,HEIGHT/2+100)
text("count = "..count,WIDTH/2,HEIGHT/2)
if et>0 then
text("wait "..(5-(ElapsedTime-et)//1).." seconds.",WIDTH/2,HEIGHT/2-100)
end
end
function touched(t)
if ElapsedTime-et>5 then
if t.state==BEGAN then
count=count+1
et=ElapsedTime
end
end
end
@bfisher - an alternative is to use an indicator variable
NoTouch=true --turns off touch
NoTouch=false --turns on touch
function touched(t)
if NoTouch==false then return end
--normal touch code goes here
end