WWPOL / Earth-Invader

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

Bullet firing crashes the game #8

Closed ROODAY closed 10 years ago

ROODAY commented 10 years ago

Upon firing a bullet, the game tab freezes, leaving no errors in the console. AFAIK, this can only be caused by an infinite loop or too many objects at once. I'm not sure which is the issue here.

liboan commented 10 years ago

I commented out the lines in update() where you update all the members of the pBullet array and it stopped crashing. Interesting...

ROODAY commented 10 years ago

Does it fire a bullet? Maybe it's trying to put in too many items in the array at the same time?

liboan commented 10 years ago

Yes it is firing a bullet. I did notice these things:

  1. It only fires one, as it should- the mousedown event listener only triggers when the mouse is still clicked, not when it's held down. Verified by checking console output.
  2. They are drawn in weird locations. I'm gonna take a look at the constructor but they are being drawn quite a distance away from the player even though they are supposed to be initialized on the player. Can provide pics if needed.
ROODAY commented 10 years ago

Push the commit, we can all work from there