Skip to content

Commit

Permalink
Merge pull request #166 from Dovyski/fix_issue_37
Browse files Browse the repository at this point in the history
Fix issue #37 FlxTilemap.overlapsWithCallback calls callback when no overlapping
  • Loading branch information
Dovyski committed Aug 20, 2013
2 parents bdaeb9f + 340ec63 commit 99447a0
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions org/flixel/FlxTilemap.as
Original file line number Diff line number Diff line change
Expand Up @@ -954,37 +954,32 @@ package org.flixel
column = selectionX;
while(column < selectionWidth)
{
overlapFound = false;
tile = _tileObjects[_data[rowStart+column]] as FlxTile;
tile = _tileObjects[_data[rowStart + column]] as FlxTile;
tile.x = X+column*_tileWidth;
tile.y = Y+row*_tileHeight;
tile.last.x = tile.x - deltaX;
tile.last.y = tile.y - deltaY;
overlapFound = (Object.x + Object.width > tile.x) && (Object.x < tile.x + tile.width) && (Object.y + Object.height > tile.y) && (Object.y < tile.y + tile.height);

if(tile.allowCollisions)
{
tile.x = X+column*_tileWidth;
tile.y = Y+row*_tileHeight;
tile.last.x = tile.x - deltaX;
tile.last.y = tile.y - deltaY;
if(Callback != null)
{
if(FlipCallbackParams)
overlapFound = Callback(Object,tile);
else
overlapFound = Callback(tile,Object);
}
else
overlapFound = (Object.x + Object.width > tile.x) && (Object.x < tile.x + tile.width) && (Object.y + Object.height > tile.y) && (Object.y < tile.y + tile.height);
if(overlapFound)
}
if(overlapFound)
{
if((tile.callback != null) && ((tile.filter == null) || (Object is tile.filter)))
{
if((tile.callback != null) && ((tile.filter == null) || (Object is tile.filter)))
{
tile.mapIndex = rowStart+column;
tile.callback(tile,Object);
}
results = true;
tile.mapIndex = rowStart+column;
tile.callback(tile,Object);
}
}
else if((tile.callback != null) && ((tile.filter == null) || (Object is tile.filter)))
{
tile.mapIndex = rowStart+column;
tile.callback(tile,Object);
if(tile.allowCollisions)
results = true;
}
column++;
}
Expand Down

0 comments on commit 99447a0

Please sign in to comment.