I really need help I have tried a million times to try to get every time you touch the screen it adds on to a number. Helpppppp
function setup()
count=0
end
function touched(t)
--add 1 when finger lifts off screen
if t.state==ENDED then count=count+1 end
end
Here might be your solution
So you added a text printout to my solution? :-?
Oh I didn’t mean copyright or anything. A more ‘Advanced’ version.
function setup()
count=0
end
function touched(t)
--add 1 when finger lifts off screen
if t.state==ENDED then count=count+1 end
end
function draw()
background(0)
fill(255)
fontSize(75)
text(count, WIDTH/2, HEIGHT/2)
end
Hope it helped!
function setup()
tx,ty=0,0
sCount=0
mCount=0
eCount=0
end
function draw()
background(40, 40, 50)
fill(255)
text("touch "..sCount,WIDTH/2,HEIGHT/2+100)
text("moving "..mCount,WIDTH/2,HEIGHT/2)
text("lifted "..eCount,WIDTH/2,HEIGHT/2-100)
text("x pos "..tx.." y pos "..ty,WIDTH/2,HEIGHT/2-200)
end
function touched(t)
tx=t.x
ty=t.y
if t.state==BEGAN then
sCount=sCount+1
end
if t.state==MOVING then
mCount=mCount+1
end
if t.state==ENDED then
eCount=eCount+1
tx,ty=0,0
end
end