I'm trying to make a function to detect if two layers collide. Using Jquery, jcanvas and HTML5 canvas
I'm building a sort of flight simulator where the player can ascend/descend to avoid hot airballons coming towards the player.
I need to detect if the plane is about to collide with the ballon layer.
I've tried checking the layers x/y position but that doesn't work so well since the hot airballon isn't squere shaped.
Imagine this:
______________ __
/ \ / / _
/ \ ___/__/_______/ /\
| Air ballon | / Plane 1 /
| | \___\ \_______\ \
\ / \ \ \/
\ / \__\
\ /
\ / __
\ / / / _
\ / ___/__/_______/ /\
\ / / Plane 2 /
\____/ \___\ \_______\ \
|__| \ \ \/
|__| \__\
In my current solution both planes will collide at the same time. I need plane 2 to collide later, when the plan actually collides with the air ballon basket