Help Please! [CLOSED]

Hello I am kinda new to codea and for a project ats school we need to make an app. The first thing that comes to mind was a clicker! I thought it would be easy. I WAS WRONG (At least for my level). I will post my current code below hoping you guys can help me. I just want to record taps, and display it as a text in the center of the screen (No fancy power ups or any of that stuff JUST a clicker!) Thank you for reading this an I hope someone can tell me where I screwed up! :smiley:

--# Main
function touched(touch)
    x = touch.tapCount 
   supportedOrientations(PORTRAIT)
end

function draw()
    print(x)
    text("TAP SUPA FAST M8",WIDTH/2,HEIGHT/2)
    text("SUPA FAST!!!",WIDTH/2,400)
end

@Kai Welcome to the forum. When you post code, put 3 ~'s on a line before and after your code so it shows properly. I added them to your code above. Here your code with corrections.

supportedOrientations(PORTRAIT)

function setup()
    x=0
end

function touched(touch)
    x = touch.tapCount 
end

function draw()
    background(0)
    text("TAP SUPA FAST M8",WIDTH/2,HEIGHT/2)
    text("SUPA FAST!!!",WIDTH/2,400)
    text(math.tointeger(x),WIDTH/2,300)
end

Ok thank you man :smiley:

Wait I just tested the code and it reset the tap count every time I stop tapping. :confused: How would I fix this?

@Kai Change the touched function to this.

function touched(touch)
    if touch.state==BEGAN then
        x=x+1
    end
end

Ok thank you :smiley:

Go to the thread