Collision of n number of sprites among each other: help needed

Hi I am creating a game using cocos2d js where on my screen, unlimited number of sprites move in random directions, now i want to detect collision between them. since I have to detect collision on each sprite with every other sprite I am getting confused how to detect it using bounding boxes. Please help

you can use built in Physics engine for it
Checkout these links for getting started


http://ggarek.github.io/cocos-creator-tutorial-cannon/index.html
https://docs.cocos2d-x.org/creator/api/en/classes/PhysicsBoxCollider.html

“since I have to detect collision on each sprite with every other sprite”

That is a rather brute force way that will get very inefficient in computational time space.
I’d suggest looking into quad trees, kNN etc. There are many types of algorithms that, if implemented well, will reduce computational strain a lot.

This example is well laid out
http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/

i am not using cocos creater. I am using simple cocos 2d js. Thanks for help