Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libs/game/physics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ class ArcadePhysicsEngine extends PhysicsEngine {
protected tilemapOverlaps(sprite: Sprite, overlappedTiles: tiles.Location[]) {
const alreadyHandled: tiles.Location[] = [];

let currentTileMap = game.currentScene().tileMap

for (const tile of overlappedTiles) {
if (alreadyHandled.some(l => l.column === tile.column && l.row === tile.row)) {
continue;
Expand All @@ -605,12 +607,13 @@ class ArcadePhysicsEngine extends PhysicsEngine {
const tileOverlapHandlers = game.currentScene().tileOverlapHandlers;
if (tileOverlapHandlers) {
tileOverlapHandlers
.filter(h => h.spriteKind == sprite.kind() && h.tileKind.equals(tiles.getTileImage(tile)))
.filter(h => h.spriteKind == sprite.kind() && h.tileKind.equals(currentTileMap.getTileImage(tile.tileSet)))
.forEach(h => h.handler(sprite, tile));
}
}
}


/**
* Returns sprites that overlap with the given sprite. If type is non-zero, also filter by type.
* @param sprite
Expand Down