@jfperusse- I have been struggling with the touched(touch) function recently, on V3 it doesn’t seem to follow my code in the latest beta. At times it doesn’t respond to a touch. When you issue a new Codea version do you just issue it with changes to V4 ? Are there any common features (routines) used between the two versions ?
Or, has there been Apple IOS updates to touch detection which have been incorporated in the latest version of Codea that may have interfered with the V3 touch functionality.
This may just be down to my coding as I still tend to use V3 a lot and the touch functionality has always been my weak spot.
@UberGoober@jfperusse - found out what the issue is but can’t explain it. Try the following code and switch the commented out ellipse commands to alternate them when run. Seems to me the command variables for positioning in the pos variable are not read as integer – V3 template
viewer.mode = FULLSCREEN
– V3 template
viewer.mode = FULLSCREEN
function setup()
–
pos = vec2(200,200)
end
function draw()
–
background(40, 40, 50)
if pos then
fill(233, 95, 78)
stroke(233, 226, 78)
strokeWidth(5)
if pos then
print(pos, pos.x, pos.y)
ellipseMode(CENTER)
ellipse(pos.x,pos,y,100,100)
– ellipse(pos.x,pos.y,pos.x,pos.y)
end
end
end
function touched(touch)
–
if touch.state == ENDED or touch.state == CANCELLED then
– When any touch ends, remove it from our table
pos = touch.x,touch.y
elseif touch.state == BEGAN then
– If the touch is in any other state
pos = touch.x+100,touch.y-100
end
end
Is this me being just a bit thick ?
p.s. the pos variable is ignored wherever you touch on the screen.
Odd - can’t seem to post In the forum with inDented format - could this be an issue wIt’s the editor?