Welcome to the forums @mikemoli!
Looking at the code, the issue is probably that the move_to
function does not return new all the time, instead only returning new
when the condition if new < to:
is true. This leads the move_to
function to return null
when the condition is not met, which causes the issue you are seeing later in the code because position.x
is set to null
.
You probably want to move the return new
code down a single indentation, so it is not linked to the condition. Lines 34 to 37 would then look like this:
if new < to:
new = to
return new
Then I think it will work as expected.
Also:
This discussion was caught in the moderation queue since you have not confirmed your account yet.
Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.
If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile: