It kind of works now
So, you're saying this
if (d1>=dist){ currentState=currentState +1; else
compiles?