HTML and CSS Reference
In-Depth Information
iif
(
top1
>
bottom2
)
return
return
(
false
false
);
iif
(
right1
<
left2
)
return
return
(
false
false
);
iif
(
left1
>
right2
)
return
return
(
false
false
);
return
return
(
true
true
);
}
Asyoucansee,thisfunctiontakesintwoparameters.Thesearethetwologicalobjectsthatwe
want to test the collision on. As long as the object instances include
x
,
y
,
width
, and
height
attributes, the function will perform properly. First let's examine the objects that we are going
to test collisions on.