Skip to content

Commit 41f81d3

Browse files
committed
jsdocs update (and removed isCircle switch)
1 parent 257a22b commit 41f81d3

1 file changed

Lines changed: 18 additions & 42 deletions

File tree

src/physics/arcade/World.js

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -980,59 +980,35 @@ Phaser.Physics.Arcade.prototype = {
980980
* Check for intersection against two bodies.
981981
*
982982
* @method Phaser.Physics.Arcade#intersects
983-
* @param {Phaser.Physics.Arcade.Body} body1 - The Body object to check.
984-
* @param {Phaser.Physics.Arcade.Body} body2 - The Body object to check.
983+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body object to check.
984+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body object to check.
985985
* @return {boolean} True if they intersect, otherwise false.
986986
*/
987987
intersects: function (body1, body2) {
988988

989-
if (body1.isCircle)
989+
// Rect vs. Rect
990+
if (body1.right <= body2.position.x)
990991
{
991-
if (body2.isCircle)
992-
{
993-
// Circle vs. Circle
994-
return Phaser.Math.distance(body1.center.x, body1.center.y, body2.center.x, body2.center.y) <= (body1.radius + body2.radius);
995-
}
996-
else
997-
{
998-
// Circle vs. Rect
999-
return this.circleBodyIntersects(body1, body2);
1000-
}
992+
return false;
1001993
}
1002-
else
1003-
{
1004-
if (body2.isCircle)
1005-
{
1006-
// Rect vs. Circle
1007-
return this.circleBodyIntersects(body2, body1);
1008-
}
1009-
else
1010-
{
1011-
// Rect vs. Rect
1012-
if (body1.right <= body2.position.x)
1013-
{
1014-
return false;
1015-
}
1016-
1017-
if (body1.bottom <= body2.position.y)
1018-
{
1019-
return false;
1020-
}
1021994

1022-
if (body1.position.x >= body2.right)
1023-
{
1024-
return false;
1025-
}
995+
if (body1.bottom <= body2.position.y)
996+
{
997+
return false;
998+
}
1026999

1027-
if (body1.position.y >= body2.bottom)
1028-
{
1029-
return false;
1030-
}
1000+
if (body1.position.x >= body2.right)
1001+
{
1002+
return false;
1003+
}
10311004

1032-
return true;
1033-
}
1005+
if (body1.position.y >= body2.bottom)
1006+
{
1007+
return false;
10341008
}
10351009

1010+
return true;
1011+
10361012
},
10371013

10381014
/**

0 commit comments

Comments
 (0)