We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm new and did a co-coded project that I'd like to upload on the open Processing forum. It's not running though and I'm not sure what the problem is...here is the link to the sketch.
http://www.openprocessing.org/sketch/132319
can anyone help?
Thanks!
Answers
1st rule for JavaScript: never have a variable & a function sharing the same name!!! b-(
Inside function steer(), you declare a local variable called steer too!!!
Rename that to something like steering or whatever! *-:)
Even after that, JS complained about the renamed steering and another variable called desired as being undefined (TypeError)!
Found out that you were using PVector's method sub() w/ 2 PVector arguments.
Its most correct usage in that case is by invoking it as static; that is, using the class's own name instead of a variable:
Check sub()'s reference:
http://processing.org/reference/PVector_sub_.html
Another way is putting the recipient PVector variable as 3rd argument:
Even though Java doesn't mind, like the case of having function & variables sharing same name, JavaScript crashes!!! [..]