+ 4

How to Make a Box Collision in JavaScript

24th Jun 2018, 11:53 AM
Amar Dahake
2 Answers
+ 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
24th Jun 2018, 12:44 PM
Toni Isotalo
Toni Isotalo - avatar
+ 2
http://lmgtfy.com/?q=JavaScript+box+collision
24th Jun 2018, 12:19 PM
Janning⭐
Janning⭐ - avatar