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
“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
i am not using cocos creater. I am using simple cocos 2d js. Thanks for help