v-castaneda / game-word-asteroid

1 stars 1 forks source link

fix collision detection function to account for incorrect top/bottom values in ssRect #23

Open v-castaneda opened 2 years ago

v-castaneda commented 2 years ago

 // storing collision detection flag
      // BUG: For some reason the top and bottom values obtained in ssRect
      // are not consistent with the image display, hence the subtraction
      // of 100 below
      let collisionFlag =
        asteroidRight > ssRect.left &&
        asteroidLeft < ssRect.right &&
        asteroidBottom > ssRect.top - 100 &&
        asteroidTop < ssRect.bottom - 100;