Skip to content

Commit 57fd8c9

Browse files
authored
Merge pull request phaserjs#4540 from BdR76/patch-2
drawDebug, display checkCollision sides
2 parents 2e64f4c + 717c89d commit 57fd8c9

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/physics/arcade/Body.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,24 @@ var Body = new Class({
14311431
}
14321432
else
14331433
{
1434-
graphic.strokeRect(pos.x, pos.y, this.width, this.height);
1434+
//graphic.strokeRect(pos.x, pos.y, this.width, this.height);
1435+
// only draw the sides where checkCollision is true, similar to debugger in layer
1436+
if (this.checkCollision.up)
1437+
{
1438+
graphic.lineBetween(pos.x, pos.y, pos.x + this.width, pos.y);
1439+
}
1440+
if (this.checkCollision.right)
1441+
{
1442+
graphic.lineBetween(pos.x + this.width, pos.y, pos.x + this.width, pos.y + this.height);
1443+
}
1444+
if (this.checkCollision.down)
1445+
{
1446+
graphic.lineBetween(pos.x, pos.y + this.height, pos.x + this.width, pos.y + this.height);
1447+
}
1448+
if (this.checkCollision.left)
1449+
{
1450+
graphic.lineBetween(pos.x, pos.y, pos.x, pos.y + this.height);
1451+
}
14351452
}
14361453
}
14371454

0 commit comments

Comments
 (0)