Skip to content

Commit 5110279

Browse files
Ninja world collision to check right and bottom bounds
The world collision algorithm need to check the right and bottom of the bounds in case the bound’s x or y are not equal to 0
1 parent 1746afe commit 5110279

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/physics/ninja/AABB.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ Phaser.Physics.Ninja.AABB.prototype = {
321321
}
322322
else
323323
{
324-
dx = (this.pos.x + this.xw) - this.system.bounds.width;
324+
dx = (this.pos.x + this.xw) - this.system.bounds.right;
325325

326326
if (0 < dx)
327327
{
@@ -337,7 +337,7 @@ Phaser.Physics.Ninja.AABB.prototype = {
337337
}
338338
else
339339
{
340-
dy = (this.pos.y + this.yw) - this.system.bounds.height;
340+
dy = (this.pos.y + this.yw) - this.system.bounds.bottom;
341341

342342
if (0 < dy)
343343
{

src/physics/ninja/Circle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
219219
}
220220
else
221221
{
222-
dx = (this.pos.x + this.radius) - this.system.bounds.width;
222+
dx = (this.pos.x + this.radius) - this.system.bounds.right;
223223

224224
if (0 < dx)
225225
{
@@ -235,7 +235,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
235235
}
236236
else
237237
{
238-
dy = (this.pos.y + this.radius) - this.system.bounds.height;
238+
dy = (this.pos.y + this.radius) - this.system.bounds.bottom;
239239

240240
if (0 < dy)
241241
{

src/physics/ninja/Tile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
165165
}
166166
else
167167
{
168-
dx = (this.pos.x + this.xw) - this.system.bounds.width;
168+
dx = (this.pos.x + this.xw) - this.system.bounds.right;
169169

170170
if (0 < dx)
171171
{
@@ -181,7 +181,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
181181
}
182182
else
183183
{
184-
dy = (this.pos.y + this.yw) - this.system.bounds.height;
184+
dy = (this.pos.y + this.yw) - this.system.bounds.bottom;
185185

186186
if (0 < dy)
187187
{

0 commit comments

Comments
 (0)