Closed cdaein closed 8 years ago
Hi, Dan
After running this example for a while, it causes an error: Uncaught TypeError: undefined is not a function at world.js:43
Uncaught TypeError: undefined is not a function
world.js line 43 is: this.food.push(b.location);
this.food.push(b.location);
it should be this.food.add(b.location);
this.food.add(b.location);
I think you were confused with ArrayList add(), which translates to push(), and the actual add() method of Food object.
Also on the same line, b.location should be b.position as it is how it's defined in bloops.js
b.location
b.position
Thanks for these corrections!
Hi, Dan
After running this example for a while, it causes an error:
Uncaught TypeError: undefined is not a function
at world.js:43world.js line 43 is:
this.food.push(b.location);
it should be
this.food.add(b.location);
I think you were confused with ArrayList add(), which translates to push(), and the actual add() method of Food object.
Also on the same line,
b.location
should beb.position
as it is how it's defined in bloops.js