+ 4
How to Make a Box Collision in JavaScript
2 Réponses
+ 4
You need to calculate the offset for both elements.
if(($(pipeTop).offset().left <= player.offset().left + player.width()) && (player.offset().left <= $(pipeTop).offset().left + $(pipeTop).width())) {
https://code.sololearn.com/WftFhf1E9UQI
+ 2
http://lmgtfy.com/?q=JavaScript+box+collision