I am making a canvas game where you shoot at an endless amount of enemies. My problem is that the I am not sure how to make the objects from the bullets array collide with those of the enemy array. Here is what I have:
enemies.forEach(hitCheck)
Then:
var hitCheck = function(object){
var a = bullets.length
if (bullets[a].x < object.x + object.width && bullets[a].x + bullets[a].width > object.x &&
bullets[a].y < object.y + object.height && bullets[a].y + bullets[a].height > object.y) {object.x += 400}
}