This is the code I am using for my collision detection:
for(var k = 0; k < enemies.children.length; k++) {
if(bullet.x >= enemies.children[k].x + wingmanWidth ||
bullet.x + sizeBullet <= enemies.children[k].x - wingmanWidth ||
bullet.y >= enemies.children[k].y + wingmanHeight ||
bullet.y + sizeBullet <= enemies.children[k].y)
{
//not
}else {
// collsion detected
}
The collision is detected between a single bullet object and multiple wingman objects in the enemies container. Now I want to detect the collision between multiple bullets in the bullets container and multiple wingman objects in the enemies container.