I trying to learn how physics in Codea works and I came across this error and I can’t figure out whats wrong.
function touched (touch)
if touch.state = BEGAN or MOVING or ENDED
p_ball.x = CurrentTouch.x
p_ball.y = CurrentTouch.y
On the line of the if statement it says " ‘then’ expected near ‘=’ "
Because of if statement syntax, you can’t say
if touch.state == BEGAN or MOVING or ENDED
With each or, you need to redefine the question. Try using
if touch.state == BEGAN or touch.state == MOVING or touch.state == ENDED then
Yeah, you also forgot to have a “then” at the end of the if statement, saying you’re done with checking boolean values.
I was wondering if the then was I the wrong place so I guess that I forgot to include it in the post…
Thanks SkyCodear! Make much more sense now.