HaxeFlixel/flixel-addons

FlxTilemapExt::overlapsWithCallback returns true for all sloped\special tiles considered

increpare opened this issue · 0 comments

Hi! Sorry about this - I haven't taken time to make an example, but thought I'd mention it here, and maybe elaborate on it in future.

If I understand correctly, FlxTilemapExt::overlapsWithCallback decides what tiles to check collisions on based on rough bounds (the row\column range stuff), and says that if overlaps if there's either an exact bounds match, or if it has some special property (the checkArrays bit)

if (overlapFound || (!overlapFound && checkArrays(tile.index)))
{
	if ((tile.callbackFunction != null) && ((tile.filter == null) || Std.is(Object, tile.filter)))
	{
		tile.mapIndex = rowStart + column;
		tile.callbackFunction(tile, Object);
	}
	results = true; //THIS RETURNS TRUE IF A SLOPE IS CONSIDERED, regardless even if you're outside the bounding box.
}

( https://github.com/HaxeFlixel/flixel-addons/blob/master/flixel/addons/tile/FlxTilemapExt.hx#L377 )

[ There's actually a second problem here as well - callbackFunction is a collision resolution function, so for slopes, overlapsWithCallback can have an effect, which I do not expect. ]

I feel like the source of the problem is that FlxTile only has one callback. Ideally there'd be custom overlap and resolve functions I'd guess? Or is there a better way to manage this?

(I should say, I'm willing to put work into getting this fixed myself, but would ideally like to do it in a way that could be pulled into\is compatible with the main engine :) )