In this tutorial I make the bugs crawl away / bounce off from each other when they get too close – by using the collision detection function, I wrote another function to make them crawl away as well as calling that function in a nested for loop (1 for loop inside another for loop).