WWPOL / Earth-Invader

WWPOL entry for JS13K. Play it here >>>
http://wwpol.github.io/Earth-Invader
1 stars 1 forks source link

Can we make the bullet & enemy arrays (or one of them) global? #9

Closed liboan closed 10 years ago

liboan commented 10 years ago

As of now there is no way for us to check for collisions inside a class update function, for example, while updating all enemies check each against the array of bullets.

I'd like to prevent adding another loop in the main update function to specifically check for collisions.

ROODAY commented 10 years ago

We could make a function checkCollisionsArrays(array1, array2) that checks all objects of two arrays against each other, and call it in the update function. Would that work?

liboan commented 10 years ago

Isn't that just going to have us traverse the arrays an extra time anyways? Id prefer collision checks to occur while we are updating individual enemies, not afterwards.

We could assign every enemy a property that points to the bullet array...maybe that will work On Aug 23, 2014 7:05 PM, "Rudy Raveendran" notifications@github.com wrote:

We could make a function checkCollisionsArrays(array1, array2) that checks all objects of two arrays against each other, and call it in the update function. Would that work?

— Reply to this email directly or view it on GitHub https://github.com/WWPOL/Earth-Invader/issues/9#issuecomment-53169614.

liboan commented 10 years ago

All set