Skip to content

Commit 26a89f0

Browse files
committed
New build files with tilemap callback fixes in.
1 parent 49bcd2e commit 26a89f0

10 files changed

Lines changed: 365 additions & 393 deletions

File tree

build/custom/phaser-no-libs.js

Lines changed: 89 additions & 96 deletions
Large diffs are not rendered by default.

build/custom/phaser-no-libs.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-no-physics.js

Lines changed: 90 additions & 97 deletions
Large diffs are not rendered by default.

build/custom/phaser-no-physics.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.js

Lines changed: 90 additions & 97 deletions
Large diffs are not rendered by default.

build/phaser.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/physics/arcade/World.js

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ Phaser.Physics.Arcade.prototype = {
655655
sprite.body.position.y - sprite.body.tilePadding.y,
656656
sprite.body.width + sprite.body.tilePadding.x,
657657
sprite.body.height + sprite.body.tilePadding.y,
658-
true, true);
658+
false, false);
659659

660660
if (this._mapData.length === 0)
661661
{
@@ -1057,31 +1057,24 @@ Phaser.Physics.Arcade.prototype = {
10571057
}
10581058

10591059
// They overlap. Any custom callbacks?
1060-
/*
1061-
if (tile.collisionCallback || tile.layer.callbacks[tile.index])
1060+
1061+
// A local callback always takes priority over a layer level callback
1062+
if (tile.collisionCallback && !tile.collisionCallback.call(tile.collisionCallbackContext, body.sprite, tile))
10621063
{
1063-
// A local callback takes priority over a global callback.
1064-
if (tile.collisionCallbackk && tile.collisionCallback.call(tile.collisionCallbackContext, body.sprite, tile) === false)
1065-
{
1066-
// Is there a tile specific collision callback? If it returns true then we can carry on, otherwise we should abort.
1067-
return false;
1068-
}
1069-
else if (tile.layer.callbacks[tile.index] && tile.layer.callbacks[tile.index].callback.call(tile.layer.callbacks[tile.index].callbackContext, body.sprite, tile) === false)
1070-
{
1071-
// Is there a tile index collision callback? If it returns true then we can carry on, otherwise we should abort.
1072-
return false;
1073-
}
1064+
// If it returns true then we can carry on, otherwise we should abort.
1065+
return false;
1066+
}
1067+
else if (tile.layer.callbacks[tile.index] && !tile.layer.callbacks[tile.index].callback.call(tile.layer.callbacks[tile.index].callbackContext, body.sprite, tile))
1068+
{
1069+
// If it returns true then we can carry on, otherwise we should abort.
1070+
return false;
10741071
}
1075-
*/
10761072

1077-
if (tile.collisionCallback)
1073+
// We don't need to go any further if this tile doesn't actually separate
1074+
if (!tile.faceLeft && !tile.faceRight && !tile.faceTop && !tile.faceBottom)
10781075
{
1079-
// A local callback takes priority over a global callback.
1080-
if (tile.collisionCallbackk && tile.collisionCallback.call(tile.collisionCallbackContext, body.sprite, tile) === false)
1081-
{
1082-
// Is there a tile specific collision callback? If it returns true then we can carry on, otherwise we should abort.
1083-
return false;
1084-
}
1076+
// This could happen if the tile was meant to be collided with re: a callback, but otherwise isn't needed for separation
1077+
return false;
10851078
}
10861079

10871080
var ox = 0;

src/tilemap/Tilemap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ Phaser.Tilemap.prototype = {
588588
if (typeof indexes === 'number')
589589
{
590590
// This may seem a bit wasteful, because it will cause empty array elements to be created, but the look-up cost is much
591-
// less than having to iterate through the callbacks array hunting down tile indexes each time, so I'll take the small memory hit.
591+
// less than having to iterate through the callbacks array hunting down tile indexes each frame, so I'll take the small memory hit.
592592
this.layers[layer].callbacks[indexes] = { callback: callback, callbackContext: callbackContext };
593593
}
594594
else

0 commit comments

Comments
 (0)