nature-of-code / noc-examples-p5.js-archived

Port to p5.js of Nature of Code examples
MIT License
1.05k stars 552 forks source link

9.05 Ecosystem world.js - after a bloop dies #39

Closed cdaein closed 8 years ago

cdaein commented 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

world.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 be b.position as it is how it's defined in bloops.js

shiffman commented 8 years ago

Thanks for these corrections!