Why does this not work?
if CurrentTouch (400,200)
then print ("well done")
Why does this not work?
if CurrentTouch (400,200)
then print ("well done")
Most likely because you aren’t touching EXACTLY 400,200. Best is to test if the touch is within (say) 5 pixels of this point, ie
if CurrentTouch:dist(vec2(400,200)) < 5 then print("well done")
It says “end” expected (to close function near line 7) near
And line 7 is function draw so it is where I did all my drawing
if CurrentTouch.x == 400 and CurrentTouch.y == 200 then
print("Well done")
end
Thankyou
I only just got codea yesterday
Sorry I was kind of asking you the wrong thing
I have ellipse(200,400,100) and I want well done to print if the player touches anywhere on that shape
local abs = math.abs
if abs(CurrentTouch.x - 200)<50 and abs(CurrentTouch.y - 400)<50 then
print("Well done")
end
It’s what I had above, with 50 instead of 5…
@ignatz you are correct! I overlooked your code, sorry… (and actuaaly your code is more accurate for the circle)