Skip to content

Commit 963ed11

Browse files
committed
Fixed getMove flow
1 parent 06acf49 commit 963ed11

1 file changed

Lines changed: 32 additions & 24 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,39 +2509,47 @@ var Body = new Class({
25092509
{
25102510
return diff;
25112511
}
2512-
else if (amount < 0 && this.isBlockedUp())
2512+
else
25132513
{
2514-
bounds = this.getBlocker(this.blockers.up);
2515-
2516-
if (bounds && this.y + amount < bounds.y)
2514+
if (this.collideWorldBounds)
25172515
{
2518-
diff = amount - ((this.y + amount) - bounds.y);
2519-
}
2520-
}
2521-
else if (amount > 0 && this.isBlockedDown())
2522-
{
2523-
bounds = this.getBlocker(this.blockers.down);
2516+
var worldCollision = this.world.checkCollision;
2517+
2518+
if (amount < 0 && worldCollision.up && this.y + amount < bounds.y)
2519+
{
2520+
diff = amount - ((this.y + amount) - bounds.y);
2521+
2522+
this.setWorldBlockedUp(true);
25242523

2525-
if (bounds && this.bottom + amount > bounds.bottom)
2526-
{
2527-
diff = amount - ((this.bottom + amount) - bounds.bottom);
2524+
return diff;
2525+
}
2526+
else if (amount > 0 && worldCollision.down && this.bottom + amount > bounds.bottom)
2527+
{
2528+
diff = amount - ((this.bottom + amount) - bounds.bottom);
2529+
2530+
this.setWorldBlockedDown(true);
2531+
2532+
return diff;
2533+
}
25282534
}
2529-
}
2530-
else if (this.collideWorldBounds)
2531-
{
2532-
var worldCollision = this.world.checkCollision;
25332535

2534-
if (amount < 0 && worldCollision.up && this.y + amount < bounds.y)
2536+
if (amount < 0 && this.isBlockedUp())
25352537
{
2536-
diff = amount - ((this.y + amount) - bounds.y);
2538+
bounds = this.getBlocker(this.blockers.up);
25372539

2538-
this.setWorldBlockedUp(true);
2540+
if (bounds && this.y + amount < bounds.y)
2541+
{
2542+
diff = amount - ((this.y + amount) - bounds.y);
2543+
}
25392544
}
2540-
else if (amount > 0 && worldCollision.down && this.bottom + amount > bounds.bottom)
2545+
else if (amount > 0 && this.isBlockedDown())
25412546
{
2542-
diff = amount - ((this.bottom + amount) - bounds.bottom);
2543-
2544-
this.setWorldBlockedDown(true);
2547+
bounds = this.getBlocker(this.blockers.down);
2548+
2549+
if (bounds && this.bottom + amount > bounds.bottom)
2550+
{
2551+
diff = amount - ((this.bottom + amount) - bounds.bottom);
2552+
}
25452553
}
25462554
}
25472555

0 commit comments

Comments
 (0)