Here is my example using box2d, my final goal is to disappear the red cells as soon as they touch the Disease and a second one where the virus will attach to the white cells. The solution is to create a contact listener so I know the values of the collision and can create functions like destroy and attach. The code is not very easy so I haven’t been able to figure it out, even with the help of Daniel Shiffman.
After I created the world and set the variables I realized that something was missing. I thought to create walls with lines that move with time, and noise. I looked at a lot of videos of cells and processing examples and I found a wonderful example in open processing.
After you mouse clicked the noise function adds massive points into the background. The cells and the disease have problems moving faster but when the toxin is flushed, they bounce between each other graciously again.
I’m exited about better understanding the contact listener function in box2d and experimenting more.
Bellow is the applet