p5 Array Trouble | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

p5 Array Trouble

Every 1 second the program is meant to spawn a circle in a random location and push it to the array. Once spawned, it is meant to stay in that location, not teleport everywhere. Why isn't it working? https://code.sololearn.com/WeLuUVw4NvuS/?ref=app

11th Jun 2019, 4:32 PM
Clueless Coder
Clueless Coder - avatar
2 Answers
+ 3
Still not working, although, if I do that it will spawn one every millisecond instead of every second (I think)
12th Jun 2019, 6:03 AM
Clueless Coder
Clueless Coder - avatar
+ 1
You are overwriting the balls locations every sec, so there can't stay. And another issue is you should not use setInterval in draw, since draw is a timer function too, it run continusly. Try put spawnObjs() directly into draw function without setInterval.
12th Jun 2019, 1:37 AM
Calviղ
Calviղ - avatar