Mitosis chain reaction, cant get it under control

Hey all,
so i created this advanced version of the mitosis simulation challange (‘https://thecodingtrain.com/CodingChallenges/006-mitosis-p5.html’) and among others included a function to remerge the cells. It kinda works but in most cases one remerch causes a chain reaction which merges all the cells in the canvas. I tried for hours solving this. can anybody help??

plus i created it in my brother wis an html file. now that i pasted it in the editor i realised it has a lot of issues showing the objects without flickering.

https://editor.p5js.org/ZenVega/present/sF40draFv

please format your code posting by pasting it into the

</> code button

of the editor header menu ( context name: Preformatted text )
it looks like
```
type or paste code here
```

also can use the ``` manually above and below your code.

thank you.


here in case of a p5.js project,
better not post code, just the link to the
https://editor.p5js.org
project in the online editor


also please edit your title so it not uses profane language
or your whole post might get flagged.

Done that, thanks for the advice

1 Like